· Tutorial ·

Basic commands to use in the terminal

In this manual you will learn the basic commands to handle the terminal of your Linux server.

Before starting the tutorial, don't you have a Cloud Linux server? Don't worry! With just one click, you can easily deploy it with SW Hosting.

Your Cloud SO from $5.60/month

Get the most out of your project with the fastest disks and most powerful CPUs in the Cloud.

CD

As the acronym of its name indicates, it is used to Change Directory.

To go to the root of the directory:

cd /

If we want to go to a specific directory:

cd my_directory/another_directory

To go to the previous directory:

cd .

LS

With this command we will obtain a "LIST" of the directories and/or files, it would be like a DIR of MS-DOS:

ls

You can use the *, which will do the wildcard function:

ls *.txt

It would show only files with the extension .txt

MKDIR

With this command you can create a directory:

mkdir new_directory

RMDIR

Unlike the previous command, this command is used to delete directories:

rmdir new_directory

MV

MV is used to move files, after the "command" we will put the file we want to move and the destination directory:

mv my_file my_directory

RM

RM is used to delete files, if accompanied by * it will delete all files in the directory you are in:

rm my_file
rm *

CLEAR

This command is used to clear the terminal screen:

clear

CP

CP of "COPY", used to copy files and directories:

cp file copy_file

You can make the copy in another directory:

cp file /directory/sub_directory

DF

DF indicates the disk space, available, used and total:

df -h

DU

DU is used to find out how much space a file occupies in a directory:

du /my_directory

If you want to know how much space is occupied by files with the same extension (with -s), you can find out:

du -s *.txt

FIND

It is used to find a file. By default, the command would show a list of all directories and files starting from the directory you are in:

find -name filename

KILL

If something doesn't work, this command will be of great help, first we will have to know which processes are running with:

kill -l

Then we will look at the number of the process that is causing us problems and we will close it:

kill -l 5

MAN

With MAN followed by the command you want, you will get the necessary help, as well as different combinations of the command in question:

man du

SU

Used to change the user, it will ask you for the password to make the change:

su other_user

EXIT

With this command you will exit the terminal and close it:

exit

Remember that with the dates (above and below) you will get a history of everything you have typed in the terminal, this way, you will save yourself from typing it again.

If you do not yet have a Cloud server with a Linux operating system, you can easily deploy it with SW Hosting.

Your Cloud SO from $5.60/month

Get the most out of your project with the fastest disks and most powerful CPUs in the Cloud.

i