You are on page 1of 4

Basics commands of Unix / Linux

I will explain all basics of unix /linux here . Firstly basic directories of unix operating system . ** /bin --> this directory contains all essential files for correct functioning of operating system .all users have permissions of these files . ** /home in this directory all user's home directory resides . his is very commonly used directory . ** /var this directory contains all variables files li!e logs " db directory etc . ** /etc all system configuration files are stored here . ** /dev additional devices li!e cd-rom " pendrive " hard dis! will found here . ** /sbin binary files " generaly super user uses these files . ** /tmp all temporary files stay here . hese locations are by default . For our ease we can change them also and we can use it . #inux is case sensitive . Permissions :$s linux is multi-user operating system . %very file and directory have permissions defined for every user . %very file and directory have their owner . owner is a user . and also a group . group is group of users . &o we have three different type of permissions . '( permissions given to owner )( permissions given to group *( permissions given to all other users . $nd every file have three types of permissions '( read permission -- those users who have read permission can read the file )( write permission -- those users who have read permission can write into the file *( execute permission -- user with this permission can execute the file . +o ls ,l in any directory hen you will see something li!e -rw-r--r-- ' root root '* -une . ''/)' file' 0ere following will explain this . r/readable" w/writable" x/ executable we can use two commands chmod and chown to change permissions and owner of the file respectively .

1ow about commands of unix . 2ne command consists of three parts i.e command name " options " parameters . example 3 grep -i 4abcds4 file.txt here " grep --> command name i --> option abcds and file.txt are the parameters of the command . 2ptions will always start with - mar! . basic commands are /command name

function

ls show files in current position cd change directory cp copy file or directory mv move file or directory rm remove file or directory pwd show current position m!dir create directory rmdir remove directory less" more" catdisplay file contents man display online manual su switch user passwd change password useradd create new user account userdel delete user account mount mount file system umount unmount file system df show dis! space usage shutdown reboot or turn off machine sort this command is used to sort to understand use of any command use man command man 5comand name > e.g man cp -->> this comand will explain everything about cp run some commands in your linux/unix machine then you will understand the difference . ls ls a ls la ls -Fa ls .bash_profile

cp .bash_profile sample.txt less sample.txt (note: to quit less, press q) rm sample.txt mkdir linux pwd cd linux pwd cd pwd rmdir linux ls .bash_profile cp .bash_profile sample.txt less sample.txt (note: to quit less, press q) rm sample.txt df df -k df -hk Paths:- relative and absolute path $bsolute 6ath /$bsolute pathe is address from root path . li!e /home/linux/ 7/linux 8elative path /this path is relative to your current path . / your current location ../ one directory above your current location pwd it will show you your current directory 8un following command one-by-one and you will understand pwd cd . pwd cd .. pwd cd .. pwd cd m!dir mydir pwd cd /9sers/invite pwd cd /9sers pwd cd /

pwd cd /9sers/invite
cd ~/mydir

Redirect, Append and Pipe :e !now output of a command is shown on the screen . i f we want to process the output then we will need some special parts . 6ipe 4;4 /some commands need input from another command or any file . 4;4 pipe will help u in giving output of one command as input to another command $ppend and redirect /'>' this sign will redirect output of a command to a file . '>>' this sign will append all output to the end of the file.

You might also like