Skip to main content

Basic linux command begginer


Hi fellas,Today we will talk about basic command ..whoever want to learn Linux he/she must be master with basic or daily route en commands.I seen many peoples who do symlink or bypass passwd file etc.. but they do not even know how to set a permisson on file or how to rename a file in linux..well.. i will discuss few command which is usefull for begginers.Lets start..

CP command

Well maybe you knows it already that cp command use for copy file or folder one place to another.

Syntax:  cp option source  destination


cp  filename   /tmp/filename    # it will copy a file to /tmp/   directory

cp -r directory   /tmp/directory  # it will copy a directory with all the file content in it to /tmp/

cp -v  filename  /tmp/filename  # it will show you copy information on terminal while copying (v=verbose)

cp -f filename /tmp/filename  # forcefully copy (f=forcefully)

Now suppose you have an old file called AR.txt now you want to copy it to diffrent location..but you do not want to change timstamp. i mean you do not want to change permission,owner,time.

cp -p  filename /tmp/filename   # it will copy file to diffrent location without changing owner, permission,timestamp

wc command

syntax:  wc -option

wc command is very usefull command when you are playing with logs file.

wc -l      # it use for show count of line in a file. suppose i want know how much line is in a file

cat filename | wc -l     # it will show you counts of line in file

wc -w                # it will show you words in file

wc -c              # shows characters in file

tail command

tail command is use for view content of a file .it will display line bottem to up. mostly this command use when you are monitoring logs.

tail -n 20  filename     # it will display 20 line from file (n=number of lines)

tail -f  access.log      # it will display line in flow.suppose you have a log file called access.log and you want to monitor live. so it will show you in flow.


head command

head command is also like tail use for display file content.but opposite to tail it will display upper to bottem.

head -n 20 filename           # display 20 line from a file

head -n 5 filename          # display 5 lines

grep command:

grep use for pattern maching.

syntax: grep -option word filename

suppose we have a file and we want to search a word called David and we want to display that work only from that file.

$grep  "David" filename  or cat filename | grep "David"

$cat filename | grep -i "David"  # i use for casesensitive.

$cat filename | grep -iv "David"   # it will not show the word david but will show others.

$cat filename | grep -A2 -B2 "David"  # it will show 2 line before the pattern mach and 2 line after the patten macth. i mean 2 line before the david word and 2 lines after.

$netstat -tulnp |grep -E --color "httpd"  # it will display httpd word with color. try this so u will understand.

find command

As name suggest fine command use for find a file or directory in system. now matter whatever location is of a file.

$find  /  -name  indishell.txt      # "/" is root  "name" is for define filename. so it will find a file called indishell.txt in /(root)



$find / -iname indishell.txt 
       # "iname" used for casesenseitive search



suppose you want to search all ".pdf files in root partition. then use this command.



$find / -name *.pdf   
        # it will search all pdf file availaible in /(root)

$find / -name *mp3          # it will search all .mp3 extention files in root

#Find all files in ur home directory which has read permission to user.

$find . -perm -u=r -type f -exec ls -l {} ;

 

#Find all files in home directory which has read permission only to group.



$find . -perm g=r -type f -exec ls -l {} ;



#Find all empty files in your home directory



$ find ~ -empty



#Find files bigger than 100MB size



$find ~ -size +100M


Find files smaller than 10M size



$find ~ -size -100M


mkdir command
 used for creat directory.

$mkdir directoryname

$mkdir -p /home/ar/directoryname     # create parent directory



mv command

move a file or directory or rename



$mv indishell.txt  /tmp/                  # it will move a file indishell.txt to /tmp/



$mv indishell.txt  ar.txt                  # it will rename indishell.txt to ar.txt



rm command
used for remove a directory or file



$rm filename           # remove filename



$rm -r                   #Remove an entire directory as well as its included files and subdirectories



$rm -f                 # remove forcefully


touch command 
used for creat an empty file

$touch filename


some other usefull commands

$pwd       #used for display current working directory



$cat    filename   # used for view content of file



$cd  /directory   # used for go into directory



$cd ..   
      # go back from current directory



$cd -         # used for go to previous directory



$clear        #Clear a command line screen/window for a fresh start.



$date 
       #Display system date



$df -h      #Display used and available disk space.



$file  file_name     #Determine what type of data is within a file.



$ls     directory    #List directory contents.

$who   # List logged-in users

$whoami   #Display current user

$finger username  #Displays info about user username

$command&  # Execute command in the background

$ps           #list all process

$free -m    #Display RAM+Swap usage




Post made by AR AR bhai ji (Thanks to him :) )



Popular posts from this blog

Baixar PS1 Crash Bandicoot 2 Cortex Strikes Back

PARTE 1: http://www.megaupload.com/?d=1AVO7X8T PARTE 2: http://www.megaupload.com/?d=WUBY6EAH

Barbarian Level 70 Paragon Level 191

Ive been thoroughly enjoying Reaper of Souls, so much so that Ive skipped posting here for some time (sorry, guys) and just concentrated on leveling-up my barbarian character. As you can see from the screenshot below, Ive been spending quite some time transmogrifying and buying up dyes making sure everythings coordinated and shit. Right now my barbarian is the most powerful (i.e., the one able to dish out the most damage) among my characters but I have a feeling that my crusader is going to overtake him really fast (at least until he levels up to 70 - just 2 more levels to go). Also, hes the sugar daddy of the bunch, the one tasked to make the most money for spending by the group. Ive given him some rest in the last couple of weeks however, preferring to adventure with my crusader and exploring his different abilities. Ill be getting him back on track soon enough though as the barbarian is my favorite class. Im currently playing at Torment II but I hope to progress to Torment III as so...

Baixar Filme Download Quadrilogia Veloses e Furiosos – Dublado

Sinopse : Eles t�m muita adrenalina e m�quinas poderosas, mas acima de tudo, eles possuem a extrema necessidade de velocidade. Nas ruas de Los Angeles, toda noite Dominic Toretto (Vin Diesel) transforma seus desafiantes em p�. Mas agora, h� um novo furor nas ruas. Eles sabem que ele � dur�o e r�pido, mas o que n�o sabem � que ele � um detetive determinado e veloz (Paul Walker). Com intensa a��o e velocidade, espantosas acrobacias e com o p� fundo no acelerador, este ataque furioso o colocar� no banco do motorista e o desafiar� a exceder os seus limites. Lan�amento : 2001 a 2008 Dura��o : 100 min apx. Cada Qualidade : DVDRip �udio : 10 V�deo : 10 Formato : RMVB Tamanho : 350 Mb apx. Cada �dioma : Portugu�s Veloses e Furiosos 1 >> Megaupload Veloses e Furiosos 2 >> Megaupload Veloses e Furiosos 3 >> Megaupload Veloses e Furiosos 4 >> Megaupload