10 essential Linux commands for beginners

This article describes some of the most commonly used Linux commands. All of these commands must be entered on the command line and you must press ENTER to execute the command you want. Please note that all Linux commands are case sensitive.

cat – displays the contents of files on the screen. Application:

# cat file.txt
# Hello World

Additionally, this command can be used to count the number of lines, words and characters in a file:

cat  | wc -l

– Number of lines

cat  | wc -w

– Number of words

cat  | wc -c

– Characters

To search for a word in a file, you can use:

# cat | grep

cd – Change directory

The ‘cd’ command should be used followed by the name of a directory, including the full path to that directory. If you cd with no arguments, your “home directory” is included in the working directory.


# cd /path/to/directory_name/

To move up one directory, you can use the cd command:

# cd ..

cp – copying files and directories


# cp


# cp /root/file /tmp/

With this command you will make a copy of the file located in the root ‘/’ directory to the ‘/ tmp’ directory if it does not exist. It will be rewritten if the file already exists.

df – checking the amount of free disk space in the file system.


# df

To get more readable (human readable) output using the command:

# df -h

free – gives information about used and free memory and paging file on a Linux machine.


# free

The -b option shows the amount of memory in bytes; the -k option (set by default) displays it in kilobytes; The -m option displays it in megabytes.

rm – removes directories, files, symbolic links, etc. from the file system.


# rm

The most common variations of this command are:

  • -f: ignore non-existent files, fast
  • -r: recursively delete directories and their contents
  • -v: ask before deleting

Note: always double check before deleting any file or directory.

Ls – displays a list of files and directories in a specific directory.

If you enter only ‘ls’ without specifying a directory, it will display a list of files and directories in the working directory.


# ls

The most common variations of this command are:

  • -a: displays all files and folders, including hidden ones.
  • -l: use long listing format

mv – moves files and directories from one directory to another, or renames a file or directory.

Usage: Move file from ‘/ root’ to directory ‘/ tmp’

# mv /root/file /tmp/

Rename ‘file1’ to ‘file2’

# mv file1 file2

passwd – change user password


# passwd

If you only run ‘passwd’ without specifying a username, you are changing your root password.

Note: Never use passwords that are easily guessed, such as passwords based on name, address, dictionary word, significant dates, etc. … A strong password consists of a combination of letters (upper and lower case), numbers and special characters and must be at least 8 characters long. You can use Linux password generation.

mkdir – creates a directory if it doesn’t already exist


# mkdir


# mkdir /var/www/

PS. If you liked this post, please share it with your friends on social media using the social media buttons or just leave a comment below.