Get Familiar with Linux Commands and Terminal

Get Familiar with Linux Commands and Terminal

Hello Hashnode Family, I am happy that you are reading my blog on Linux. In this article, I am going to demonstrate basic commands that will be needed to get familiar with Linux. I am just switched to a full-time Linux operating system user. I will update the article as I come across the commands. So, this article will be updated on regular basis.

What is Linux?

Linux is an operating system, like macOS or Windows. It is also the most popular Open Source operating system, and it gives you a lot of freedom.

What is Shell?

A shell is a command interpreter that exposes an interface to the user to work with the underlying operating system. It allows you to execute operations using text and commands, and it provides users with advanced features like being able to create the script.

Note: I will suggest taking a look at this site for Simplified and community-driven man pages tldr man

I have used Ubuntu OS for demonstrating the below commands. Let's get started:

1. whoami:

Prints currently logged username.

 whoami

2. man:

An interface to the system interfaces manual. It is a manual for the commands.

man man

3. clear:

Clears the screen of the terminal. This command will clear your terminal screen.

clear

4. ls:

List all the files and directory contents present in the current directory.

ls

5. cd:

This command changes the current working directory.

cd {{path/to/directory}}

6. pwd:

pwd stands for Present Working Directory. It prints out the current working directory.

pwd

7. mkdir:

This command creates one or more directories in a given path.

mkdir mydir1/

8. rmdir:

Removes an empty directory.

rmdir mydir1/

9. rm:

Removes the files or directories.

rm abc.html

To remove a directory that contains files and folders

rm -rf text/

10. cp:

Copy files and directories to destination.

cp {{source of file or directory}} {{Destination for file directory}}

11. mv:

Move or rename files and directories to a target location.

mv {{source}}   {{target}}

12. touch:

Create a new empty file(s) or change the times for the existing file(s) to the current time.

touch abc.html

13. find:

Used to find files and directories. The below command will find all the files with the name index.html in the current working directory.

find . - name index.html

14. ln:

Creates links to files and directories.

ln abc.html

15. gzip:

Compress/uncompress files with gzip compression

gzip star.html
gzip -d star.html.gz

16. head:

Print the first 10 lines of FILE to standard output.

head abc.html

17. tail:

Print the last 10 lines of FILE to standard output.

tail abc.html

18. cat:

Concatenate files and print on the standard output. (Can not create FILE if not present).

cat abc.html

19. echo:

Display a line of text. The below command creates a HTML file with text Hello World

echo Hello World > abc.html