Linux Commands
Linux

Main Linux Commands Easy Guide

Main Linux Commands That You Should Know As A Beginner

On previous post we discussed how to install Linux now we are going to talk about the most powerful thing in Linux which is Linux commands or shell commands

for the whole documentation of Linux Commands, you can check Linux Documentation

if you will use Linux you should know that the power of Linux resides on the power of its shell and the commands you can use in that shell which gives you the ultimate power

Here I’m going to talk about the main Linux commands that you will use on your daily use of Linux with their main parameters or the most used

our main points are

ls Command

cd Command

cp Command

mv Command

rm Command

mkdir Command

rmdir Command

chown Command

chmod Command

locate Command

updatedb Command

date Command

tar Command

cat Command

less Command

grep Command

passwd Command

du Command

reboot Command

halt Command

ls Linux Command

List the content of the current directory

Parameters

–l

to list the content as a detailed list

-a

Display all files includes hidden files

You can combine parameters like this

Example

 

linux ls command

cd Linux Command

Change directory from current directory to another one

Example

 

Will go to home directory

linux cd command

cp Linux Command

Copy the source to target

 

Parameters

-i

Interactive mode means wait for confirmation in case you will overwrite file on the target

-r

Recursive copy means include subdirectories if found

Example

 

targetdir

linux cp command

mv Linux Command

Move the source to target and remove the source

 

Parameters

-i

Interactive mode means wait for confirmation in case you will overwrite file on the target

Example

 

linux mv command

rm Linux Command

Delete file or directory and you must use –r in case you want to delete directory

 

Parameters

-r

Recursive delete means delete all subdirectories if found

-i

Interactive means wait till confirmation

linux rm command

mkdir Linux Command

Create new directory

Example

 

linux mkdir command

rmdir Linux Command

Delete a directory

linux rmdir command

chown Linux Command

Change the ownership of a file or directory to the user you specify

Parameters

-R

Capital R here Recursive means change ownership of all subdirectories if found and you must use this parameter if you use the command with a directory

Example

 

linux chown command

chmod Linux Command

Change the permission of a file or directory

Parameters

Mode which is divided into 3 parts owner, group and others means what will be the permissions for those and you must specify them

Every one of the 3 modes takes permission

The permission is one of the followings

Read =4

Write = 2

Execute =1

Every permission represented with a number as shown and you can combine permissions

Example

That means set permission for the file named myfile as follows

owner: set it to 7 which means 4+2+1 means read+write+execute

group: set it to 5 which means 4+1 means read+execute

other: set it to 5 which means 4+1 means read+execute

Note: execute for a folder permission means opening it

linux chmod command

locate Linux Command

To find a file in your system this command will search the system for the pattern you provide

Example

 

linux locate command

updatedb Linux Command

updates the database used by locate command

date Linux Command

Simply prints the today date just type date on the shell

tar Linux Command

Combines several files into archive and compression if you want

Parameters

-c

Create new archive

-z

Compress the resulting archive using gzip package

-j

Compress the resulting archive using bzip2 package

-v

Verbose mode show the processed files

-f

Write the output to a file and not to screen

-x

Unpack files from archive

Example

 

linux tar command create

this command will pack and compress all files in folder myfiles to a compressed archive named myfiles.tar.gz

 

linux tar command extract

this command will decompress the archive

cat Linux Command

Display file content to screen without limits

Example

 

linux cat command

less Linux Command

displays file content with scroll screen so you can navigate between pages using PgUp, PgDn, Home and En

grep Linux Command

Search for a string in specified files and display which line contains the found string

Parameters

-R

Recursive search inside subdirectories if found

-i

Insensitive search and ignore case

-l

Display file name, not the text lines

 

Example

linux grep command

passwd Linux Command

Used to change your user password or the root user may change his password or any user on the system with that command

linux passwd command

du Linux Command

Calculates the disk usage of a file or directory

Parameters

-h

Display human readable form

-s

Summarize the output total size

Example

linux du command

reboot Linux Command

Reboot the system immediately, just type reboot

halt Linux Command

Shut down the system but make sure to close all of your files to avoid data lose

And those are the Main Linux Commands that can make you kick start and go for a lovely trip with Linux

 

This is just some of the main Linux commands

Notice that any command that you forget the parameters used on it just type the command and –help as a parameter and it will show the used parameters so you don’t have to remember all those parameters at the beginning

to be continued.

Basic Linux commands part2