6 Essential Linux Terminal Commands Everyone Should Know by@techdobz

6 Essential Linux Terminal Commands Everyone Should Know

image
Bhargav Kuvadiya HackerNoon profile picture

Bhargav Kuvadiya

I'm a Freelancer , writer , electronics & Communication Engine

Linux is one of the best-known and most used operating systems in the world.

Major Linux distributions are Linux Mint, Debian, Ubuntu, Archlinux, Fedora, Opensuse, centos, and FreeBSD.

Many Linux distributions provide graphical user interfaces but you should also know how to work with the Linux terminal and for that you should know basic commands of Linux OS.


Here are 6 essential commands which can make you better at using Linux systems.

1. alias

This command allows you to define temporary aliases in your shell session.


It’s like variables in programming but instead of storing a value/string in the variable, you will store the command in a variable.

syntax :

alias [option] [name]='[value]'

usage :

alias c=’clear’

output :

image

Reverse alias with unalias command

usage :

unalias c

output :

image

2. kill

The kill command sends a signal to particular processes or a process group, causing them to act according to that signal.

Default signal when none specified : -15 ( -TERM )

The most common signal used in kill are:

1 ( HUP ) - Reload a process

9 ( KILL ) - kill a process

15 ( TERM ) - stop a process

To get a list of all available signals, we have to invoke -l option

kill – l

output :

image

usage :

Find process id of a particular process

commands : top, pidof, ps, pgrep

ex :

pidof atom

output :

10607 10531 10512 10499 10474 10472 10471 10468

next command :

kill -9 10607 10531 10512 10499 10474 10472 10471 10468

or 

kill -9 $(pidof atom)

3. man

This command is very essential because it is a manual of all the commands in Linux.
You can use this command to see another command syntax, usage, and what that command does.

usage :

man ls

output  :

image

4. chmod

This command allows you to change the permission of any files.

The Basic permissions are

r ( read ), w ( write ), x ( execute )

The most common use of this command is, execute permission

syntax :

chmod [OPTION]... MODE[,MODE]... FILE...

usage :

chmod +x change.sh

ls -l (this command allows you to see the permissions of a particular file)

ls – l change.sh

output :

-rwxrwxr-x 1 dobz dobz 104 Dec  6 08:14 change.sh

Here, First rwx -> owners, second rwx -> groups, third rwx -> others

5. top

This command is an all information-packed dashboard, it will show all ongoing activity on your Linux system.

usage :

top

output :

image

This has two areas

  1. summary area ( Memory info )
  2. task area ( processes )

6. common all-time use commands

mkdir —To make a directory ( ex: mkdir tech_dobz)
cd — Change directory ( ex: cd tech_dobz/)
pwd — Show current working directory ( ex: pwd)
touch — To make files ( ex: touch sample.txt)
ls — To list all the files and directories ( ex: ls)
rm — To delete the file or directory ( ex: rm sample.txt)
cd .. — To get into the previous directory ( ex: cd .. )

output :

image

“I’m not a great programmer; I’m just a good programmer with great habits.” — Kent Beck

Learning is a never-ending journey you have to learn new things to cope up with this era.
Build a habit of learning new things, whether it’s just for 15 min a day.

Tags