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

  1. cd <directory>

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

 

rmdir - Remove directory

  1. rmdir <directory>

Removes directory.

 

rm - Remove

  1. user@server:~$ rm <file>

Removes directory

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

Removes directory and all its contents.

 

cp - Copy

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

Copy files and directories from origin to destination.

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

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

 

mv - Move

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

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

 

Clear -

  1. user@server:~$ clear

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

 

History

  1. user@server:~$ history

It shows the last commands entered by the current user.

 

Cat - Concatenar

  1. user@server:~$ cat -n

It displays the contents of a file listing the lines.

 

Head -

  1. user@server:~$ head

It shows the first 10 lines of the specified file.

 

Tail -

  1. user@server:~$ tail

Displays the last 10 lines of a specific file.

 

pwd - Print work directory

  1. user@server:~$ pwd

Displays the working directory, the one you are located.

 

touch - Update

  1. 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

  1. user@server:~$ wget <url>

Download the file from the specified website.

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

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

 

ps - Process status

  1. user@server:~$ ps -aux

Displays information about all processes running on the system.

 

top - Top processes

  1. user@server:~$ top

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

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

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

 

man - Manual

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

Displays help pages of this command.

 

whatis - What is this command

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

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

 

unzip - un zip file

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

Unzip a zip file.

  1. 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)

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

It creates a file containing the listed files

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

It extracts the tar file.

 

gzip - GNU zip

  1. 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

  1. user@server:~$ drush cc

Clear the cache of the drupal site.

  1. 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