20 Most Frecuently Used Linux Commands

By
César Álvarez's picture
César Álvarez
· 07/10/2015

Mastering Linux command line is a great help for any web developer in order to be more flexible and independent when working in environments of Linux / Unix development. 

Here we give you the 20 most used commands for newbies who want to start this black magic.

cd - Change directory

cd <directory>

Change the current working directory, that means, it moves us to that directory.

 

rmdir - Remove directory

rmdir <directory>

Removes directory.

 

rm - Remove

user@server:~$ rm <file>

Removes directory

user@server:~$ rm -r <directory>

Removes directory and all its contents.

 

cp - Copy

user@server:~$ cp <origen> <destiny>

Copy files and directories from origin to destination.

user@server:~$ cp -r <origen> <destiny>

But so it does recursively, that is, copy the directory and its contents.

 

mv - Move

user@server:~$ mv <origen> <destiny>

Moves files or directories from origin to destination. It Moves them but does not copy them!

 

Clear -

user@server:~$ clear

Clears all text from the terminal and leaves it as if we had already opened it.

 

History

user@server:~$ history 

It shows the last commands entered by the current user.

 

Cat - Concatenar

user@server:~$ cat -n 

It displays the contents of a file listing the lines.

 

Head -

user@server:~$ head 

It shows the first 10 lines of the specified file.

 

Tail -

user@server:~$ tail 

Displays the last 10 lines of a specific file.

 

pwd - Print work directory

user@server:~$ pwd

Displays the working directory, the one you are located.

 

touch - Update

user@server:~$ touch <name of the file>

Create an empty file with the specified name and if the file exists, it update the modification date.

 

wget - www get

user@server:~$ wget <url>

Download the file from the specified website.

user@server:~$ wget -r <url>

Download the complete specified website (-r recursively until 5 levels of the site).

 

ps - Process status

user@server:~$ ps -aux

Displays information about all processes running on the system.

 

top - Top processes

user@server:~$ top

Displays information about the processes than consume most of the CPU.

user@server:~$ top -u <username>

Displays information about the top processes executed only by a particular user.

 

man - Manual

user@server:~$ man <name-command>

Displays help pages of this command.

 

whatis - What is this command

user@server:~$ whatis <name-command> 

It shows a brief description about what makes or what is the consulted command for.

 

unzip - un zip file

user@server:~$ unzip <name-file.zip> 

Unzip a zip file.

user@server:~$ unzip -l <name-file.zip>

List the contents of a file without unzipping it.

 

tar - Tape archive

It creates, displays and extracts tar files (the name comes from the old magnetic tape systems)

user@server:~$ tar -cvf <name-file.tar> <file1> <file2> 

It creates a file containing the listed files

user@server:~$ tar -xvf <name-file.tar>

It extracts the tar file.

 

gzip - GNU zip

user@server:~$ gzip <name-file>

Create and unzip gzip files.

 

 

Here there’s an extra one to finish, Drush: a specific tool for Drupal. With this tool, you can access almost all the functions of a drupal installation from the command line.

drush - commands interface for drupal

user@server:~$ drush cc

Clear the cache of the drupal site.

user@server:~$ drush vset maintenance_mode 1

Put the site in maintenance mode.

Here is the complete list of the drush commands.

 

Main photo: Uriel Soberanes
Share 
How can we help?Get in touch