Here is a cheat-sheet for Ubuntu terminal commands

According to recent statistical data, more than 90 percent of hosting services and cloud infrastructure function in Linux. That’s why if you are planning to purchase VPS Italy, you should be familiar with the most used commands. Here we will share Ubuntu terminal commands, so if that topic sounds interesting to you continue reading.

Ubuntu terminal commands

We will share here the most basic commands that will help you to get a primary understanding of how everything functions in Ubuntu.

sudo

This is probably the most widely-used command word that means superuser. So, you are adding it when you want to run something as an administrator. Once you understand this word, let’s dive into a couple of other commands with practical examples of their usage.

apt-get

This is also an extremely used command that is needed for upgrading/installing/updating/removing the packages. Here are a couple of examples to use apt-get properly.

        Upgrade

user@mycomputername:~$ sudo apt-get upgrade

By the usage of the above-mentioned command, you will update all the packages that have them available. To upgrade only one specific package, add a space after upgrade and specify its name.

        Update

By the usage of this command as in the example below, together with the packages, the system will be also updated.

user@mycomputername:~$ sudo apt-get update

        Install

To install the needed package just specify which one after the command. To install the program, you can specify its name instead of a package.

user@mycomputername:~$ sudo apt-get install curl

ls

This command lists all the files in the current directory, it looks like this:

user@mycomputername:~$ ls

If you need to check files in a certain directory, then you are using pretty much the same line, but after ls you will add a direct path. With the usage of -a, you will be shown the hidden files, this command should be:

user@mycomputername:~/Dev$ ls -a

echo

One more command that cannot be missed is echo. It is used for printing the needed text on your terminal. By using this command word as in the example below, every word in the line is an argument:

Input: user@mycomputername:~$ echo Every word should be an argument.

Output: Every word should be an argument.

However, when you just add “” before and after the sentence or phrase, it will be accepted as one argument. For instance:

Input: user@mycomputername:~$ echo “Every word should be an argument.”

Output: Every word should be an argument.

Quotes are extremely important and should be used when it is needed to accept a phrase as one argument. For instance, in case we need to find a certain file which name includes spaces then quotes are important. Otherwise, it will be accepted as an error.

cd

This command word is used to change the current directory, there are 2 variants to do it:

user@mycomputername:~Dev/Python$ cd /

user@mycomputername:/$

With the usage of the following command, you can be returned to the root direct:

user@mycomputername:~/Dev/JS Practice$ cd ..

user@mycomputername:~/Dev$

By usage of the following command, you will be taken to the parent directory from JS:

user@mycomputername:~/Dev$ cd JS

The next command will redirect from the current directory to the previous one:

user@mycomputername:~/Dev$ cd –

The following command line will redirect to the user directory:

user@mycomputername:~/Dev/JS $ cd ~

pwd

In order to show the full path of the working direct, you can use the following command line:

user@mycomputername:~Dev/PHT/Skills$ pwd

mv

Most users prefer a copy command, but sometimes it will be more effective to move a file from one to another directory rather than just copying it. The syntax of the following command is like – mv, space, name of the file that you want to move, and location. Here is an example of what it can look like:

user@mycomputername:~/Dev/Python$ mv art.py /home/user/Dev/RTG/Skills

With the usage of the above-discussed command, you can also move directories, but not only files.

mkdir

This is one more useful command that is applied for creating a directory. You can determine the location of this directory as in the example below:

user@mycomputername:~$ mkdir Commands /home/user/DFR/Skills

In case there is a necessity to create a directory in the current direct, then your command line will look like:

user@mycomputername:~/Dev/Bash$ mkdir Commands

find

With the usage of this command, you will be shown current sub-directories/directories:

user@mycomputername:~$ find Dev

By adding * to the find command, you can specify extensions:

user@mycomputername:~/Dev/Skills$ find -name “*.py”

cat

This command word is needed to show the file content. An example looks like the following line:

user@mycomputername:~\$ cat Dev/Skills/asr.py

In order to search in the current direct, use the following example line:

user@mycomputername:~/Dev/Skills\$ cat asr.py

Also, it is possible to return the content with the usage of -n part, the following example shows how it can be used:

user@mycomputername:~ /Dev/Skills\$ cat -n asr.py

clear

To clear all the information from the terminal except for the current file/directory use the following example:

 

user@mycomputername:~\$ clear

Share on Social Media