The Blog

5 Basic Commands in Linux

5 Basic Commands in Linux That Every Linux User Should Know – Part2

We have already discussed 5 Linux basic commands in a previous blog post. Let us go through another 5 commands, that are very important.

1. touch command

Touch command is used to create empty files.

touch myfile

Touch is also used to change timestamps on existing files and directories. Give it a try, do a ls -l on a file, and note the timestamp, then touch that file and it will update the timestamp.

root@devopsgurukul : /home/devopsgurukul# ls –l myfile

-rw-r—r—1 root root 0 Feb 5 10:00 myfile

root@devopsgurukul : /home/devopsgurukul# touch myfile

root@devopsgurukul : /home/devopsgurukul# ls –l myfile

-rw-r—r—1 root root 0 Feb 5 10:03 myfile

root@devopsgurukul : /home/devopsgurukul#

2. file command

In Linux, filenames aren’t required to represent the contents of the file. You can create a file called funny.gif that isn’t actually a GIF.

To find out what kind of file a file is, you can use the file command. It will show you a description of the file’s contents.

root@devopsgurukul : /home/devopsgurukul# cat >> myfile



root@devopsgurukul : /home/devopsgurukul# file myfile

myfile: ASCII text

root@devopsgurukul : /home/devopsgurukul#

3. history command

In your shell, there is a history of the commands that you previously entered, you can actually look through these commands. This is quite useful when you want to find and run a command you used previously without actually typing it again.

You can use ‘!!’ command to run the previous command without typing it again. After running the history command, if you want to run any command using the command number, you can type ‘!command number’.

Clear command will clean up your screen.

One of the most useful features in any command-line environment is tab completion. If you start typing at the beginning of a command, file, directory, etc., and hit the Tab key, it will autocomplete based on what it finds in the directory you are searching for as long as you don’t have any other files that start with those letters. For example, if you were trying to run the command myfile, you can type ‘myf’and press Tab and it will autocomplete myfile.

4. uname command

uname (short for unix name) is a computer program in Unix and Unix-like computer operating systems that prints the name, version and other details about the current machine and the operating system running on it.

root@devopsgurukul:~# uname -a

Linux devopsgurukul 4.9.0-16-amd64 #1 SMP Debian 4.9.272-2 (2021-07-19) x86_64 GNU/Linux


5. mkdir command

The mkdir command (Make Directory) is useful for that, it will create a directory if it doesn’t already exist. You can even make multiple directories at the same time.

root@devopsgurukul:~# mkdir books paintings

You can also create subdirectories at the same time with the -p (parent flag).

root@devopsgurukul:~# mkdir -p books/hemmingway/favorites

The series of introducing new commands will continue like this. These are very basic commands which will help you to use Linux and learn it. DevOps Gurukul is one of the best training academies which provides Linux courses in Kochi and the Best online Linux Course in Kerala. We have experienced training professionals who are passionate about grooming the right candidates to start their successful careers. Come learn with us and have a bright future!

Leave a Comment

Your email address will not be published.


Powered by WhatsApp Chat

× How can I help you?