Basic Linux Commands

Here I will be explaining the most used Linux commands. Linux is a UNIX-like operating system based on the Linux kernel. The following commands will help you get started with the Linux terminal.

ls Command

This command is used to list the contents inside the directory.

The following command lists the content inside the home directory:

ls /home

mkdir Command

This command is used to create a new directory.

mkdir Linux

This creates a new directory Linux in your current location.

cd Command

cd stands for Change Directory. We can use this command to move through directories.

cd /home

To go back to the previous directory

cd ..

pwd Command

pwd stands for print working directory. This tells the current location where you are

pwd

image.png

cat Command

cat stands for concatenate. This command is mostly used for viewing the content inside a file.

cat

image.png

touch Command

This command is used to create the empty file.

touch file.txt

The above command creates a new empty file file.txt.

head Command

This command is used to display the first 10 lines of the file

head

image.png

Adding head -3 displays the first 3 lines of the file.

tail Command

This command is used to display the last 10 lines of the file

tail

image.png

Adding tail -3 displays the last 3 lines of the file.

alias Command

This command lets you have temporary aliases in your shell session. While creating an alias you instruct the shell to replace a word with a series of commands.

alias move="cd /home/ironman/ | ls"

image.png

alias

This command lists the aliases that are set.

unalias Command

As the name suggests the unalias command removes the alias from the aliases.

unalias move

image.png

Additional options

All the above commands have additional options you can type this in your shell to find out the different options available

[command name] --help

For example

The following command display's all the files in the current directory including the hidden files and directories.

ls -a

image.png

Thank you for reading my blog and leave out your questions in the comments below.

Did you find this article valuable?

Support Shrikar Kulkarni by becoming a sponsor. Any amount is appreciated!