1. BASICS OF UNIX
• Unix was developed by ken Thompson in 1969
• Unix is CUI operating system
• CUI stands for command user interface OS
• It is a case sensitive
• It is multitasking operating system
• It is derived from UNICS assembly language
• UNICS stands for Uniplexed information computing system
2. Features of Unix
• Multi User Capability
• Multi Tasking Capability
• Portability
• Communication(Electronic Mail)
• Security
• Open System
• Help Facility
• $ indicates login in Normal User Level
• # indicates Login in Super User Level
3. Flavors of Unix
Unix level we have multiple flavors of Operating systems using Unix Code they
can implemented Different operating systems ‘s those are
Company Operating System Plat Form
Sun Micro Systems Solaris SPARC Server
IBM AIX Main Frames level
HP HP – UX (HP – UNIX) ProLiant
Compaq true64 Alpha Processors
BSD BSD OS Intel Processors
Red Hat Linux RHEL ,Centos,Fedora,Ubuntu, SUSE
Linux
Etc Nearly 120 Flavours developed in
Linux
4. Basic commands
logname : It displays current user
Syntax : $logname
pwd : It displays present working directory path
Syntax : $pwd
date : It displays system date and time
Syntax : $date
cal : It displays current month calendar
Syntax: $cal
clear: To clear the screen
Syntax: $clear
cal 2010 : It displays 2010 calendar
Syntax: $cal 2010
5. cont.
uname : It displays operating system name
Syntax : $uname
uname -r : It displays kernel version
Syntax : $uname -r
hostname : It displays server name
Syntax : $hostname
hostname -i : It displays server IP address
Syntax : $hostname -I
who : It displays list of users who connected to the server
Syntax : $who
finger : It displays user information
Syntax : $finger username
6. cont.
who am i : It displays current user information (parent user)
syntax : $who am i
whoami : It displays switched user name (child user)
syntax : whoami
tty : It displays terminal name
syntax:$tty
uptime : It displays how long server is up and running ,No. of users
connected and avg load on the serever
syntax : $uptime
su : It is used to switch from one user account to another user account
syntax : $su -username
7. cont.
which : It displays location of the given command
syntax: $which
exit : To logout from current user
syntax: $exit
man : It displays help page of given command
syntax: man commandname
8. Working with files
cat : This is used to create a new files (or) To open existing
files (or) To append data to existing file
1.Creatinganewfile:
Syntax : $cat>filename
---------------
---------------
ctrl +d
9. Cont.
2. How to open a file :
syntax : $cat<filename (or) $cat filename
3. Appending data to a file :
syntax : $cat>>filename
- - - - - - - - -
- - - - - - - - -
ctrl + d
10. Cont.
4.howtoopenmultiplefiles:
syntax : $cat<file1 file2 file3 - - - - - - file n
It displays first file1 file contents followed by file2 file followed by file3
i.e. It joins multiple files vertically without space
touch : It is used to create empty files i.e. zero bytes
files
syntax : $touch filename
Creatingmultiplefiles:
syntax : $touch file1 file2 - - - - - file n
It creates f1,f2,…..etc as new empty files
11. Deleting files
1. rm : To delete a file
syntax : $rm filename
2. rm -i : It deletes a file with conformation
syntax : $rm -i filename
ex : $rm -i sample ? Y (yes) or N (no)
3. rm -f : It deletes a file forcibly
syntax : rm -f filename
Remove multiple files :
syntax : $rm file1 file2 file3 - - - - - - file n
12. Working with directories:
1.Mkdir : To create a new directory
Syntax : $mkdir directory name Ex : $mkdir sample
2.Cd : To change a directory path
Syntax : $cd directory name
3. Cd .. : To come out from current working directory
Syntax : $cd ..
4. cd : It a changes to root directory
Syntax : $cd
5. Creating multiple directories :
Syntax : $mkdir abc xyz axc
Then create The abc xyz axc directories
13. Cont.
Removing directory :
1. Rmdir : To remove directory but directory must be
empty
Syntax : $rmdir directory name
Options :
a) rm -r : It deletes recursively entire directory structure with conformation
Syntax : rm -r directory name
b) rm -ri : It deletes recursively entire directory structure with
conformation
syntax : $rm –ri directory name
Copying a file :
cp : To copy a file from source to target
syntax : $cp source file Target file
ex : $cp file1 file2 : This will copy the contents of file 1 into file 2 . If file 2 is
already existed it overwrites
$cp -i file1 file2 : if file2 is already existed then it ask the confirmation
Syntax : $cp -i file1 file2
14. Cont.
• Movingfiles:
mv : To rename (or) move the file/directory
Syntax : $mv file1 file2 (for file)
mv -R :
syntax : $mv file1 file2 (for directory)
For Hiddenfiles : To hide a file or directory start filename or directory with
“.” (dot) character
syntax : $cat > .filename
- - - - - - - -
ctrl + d
1.$mv file .file : To hide existing a file
2. $mv .file file : To unhide a file
3. $mkdir .dirname : To hide directory
15. Viewing list of files
ls : It list current directory all files and subdirectories in the ascending order based on
ASCII values
syntax : $ls
Options :
ls -a : It list all files along with the hidden files
syntax : $ls –a
ls -r : It list all files in reverse order
syntax : $ls -r
ls -R : It list all files recursively
syntax : $ls -R
ls -t : It list all files based on date and time of creation
syntax : ls -t
ls -l : It list all files in log list format
syntax : $ls -l
16. Cont .
wc : It counts total no. of lines, words and characters in given file
syntax : wc filename
Options:
1.wc -l : itcountsno.oflinesinthegivenfile
syntax:$wc -l
2.wc -w : itcountsno.of wordsinthegivenfile
syntax:$wc -w
3.wc -c : itcountsno.ofcharactersinthegivenfile
syntax:$wc -c
4.wc -lw: itcountsno.oflinesandwordsinthegivenfile
syntax:$wc -lw
17. Cont.
cmp : It compares two files character by character if no output ,then files
are same other wise the files are not same
syntax : $cmp file1 file2
diff : It displays different lines b/w two files (line by line)
syntax : diff file1 file2
file : It displays the given filename
syntax : $file filename