6

6 Essential Linux Terminal Commands Everyone Should Know

 2 years ago
source link: https://hackernoon.com/6-essential-linux-terminal-commands-everyone-should-know
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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 :

E4fOkGKE4ef5TCdpSC8al55DmLm2-jy128b8.png

Reverse alias with unalias command

usage :

unalias c

output :

E4fOkGKE4ef5TCdpSC8al55DmLm2-nq228cm.png

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 :

E4fOkGKE4ef5TCdpSC8al55DmLm2-3a328jb.png

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  :

E4fOkGKE4ef5TCdpSC8al55DmLm2-j3428v7.png

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 :

E4fOkGKE4ef5TCdpSC8al55DmLm2-tp728oz.png

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 :

E4fOkGKE4ef5TCdpSC8al55DmLm2-ep828h5.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK