fbpx


Here are 7 important Linux commands to use during your SSH session.

Move Command:

Move command is used to move files around or even rename files, here’s the generic form:

“ mv [options] SOURCE DESTINATION “

Let’s say we want to move FILE1 to the previous FOLDER

“ mv FILE1.TXT .. “

or we want to rename FILE1 to X

“ mv FILE1.TXT ./X.TXT

ok let’s make it even harder and let’s say we want to move everything to the previous folder:

“ mv * ../ “

NOTE: * mean everything in this particular example it meant everything in this folder.

Change Directory:

cd is a simple command to change directory, Here’s the generic form:

“ cd DESTINATION “

For example, we want to move to /home/var/www

“ cd /home/var/www “

ok now let say we want to move to a folder inside the current folder:

“ cd ./FOLDER-NAME “

or even move to the previous folder simply write:

“ cd .. “

Simple ! huh ?

Remove File Or Directory:

rm command is used to remove files, and in order to remove folders you have to include -rf for example :

“ rm * “

The previous command will actually remove all files if the current folder contains folders as well you need to do the following

“ rm -rf * “

This command will result in removing everything in the current folder. Keep in mind you can also remove the and specify a folder name instead.

NOTE: In some cases, you might need to use SUDO to be able to execute this command.

List Directory Content:

ls is used to list all files and folders inside the current folder.

“ ls “

we are not going to go into the details of this command since it is mostly used as demonstrated above.

Change Mode Command:

CHMOD or Change mode command is used to change permissions of files or folder “Directory”. It is crucial if you want to give a system a power to do things or even restrict it.

“ chmod XXX NAME-HERE “

you replace XXX with the permission number. There is also another variation for changing the mode recursively as following

“ chmod -R XXX FOLDER-NAME “

Web Get :

Web Get or wget command is used to download stuff from the internet directly to your machine instead of using FTP or SFTP. In some cases, you need to install it using your package manager depending on your OS. For Ubuntu or other Debian based distribution you can install it using the following command:

“ sudo apt-get install wget “

After that, you are ready to go. Here are some examples:

“ wget URL “

It is preferred to be a compressed file Like .ZIP So you can unzip it easily. It is used for example to download WordPress files for any other purpose.

UNZIP Command:

UNZIP command it’s simply a command to “unzip” or uncompress files from a ZIPPED file. Let’s say you got a file from wget command and you want to unzip in the current folder you do the

following:

“ unzip FILE-NAME.ZIP “

If you don’t know the file name you just use the command above “ ls “. You can also specify the destination using:

“ unzip FILE-NAME.ZIP -d DESTINATION “

NOTE: In some cases, you need to install it using your package manager depending on your OS. For Ubuntu or other Debian based distribution, you can install it using the following

command:

“ sudo apt-get install unzip “

Finally, I would like to note that some commands mentioned above have some other options or variations. This is just a basic guide to get you started with your VPS or SERVER.