Basic Unix Command
Basic Unix Command
Biru Rajak
Coordinator, Computer Sc. Dept.
Asansol Girls’ College
BCA Coordinator, KNU (Add. Charge)
[email protected]
man
• Manual Pages
• Contains information about almost everything
- Other Commands
- System Calls
- C Library Functions
Syntax:
man <command name>
Example:
% man ls
which
• Displays a path name of a command
• Searches a path environmental variable for the
command and displays the absolute path
Syntax:
which <command name/app>
Example:
% which sh (shows which sh is actually in use)
whereis
• Display all locations of a command (or some
other binary, man page, or a source file).
• Searches all directories to find commands that
match the argument
Syntax:
whereis <command name>
Example:
% whereis sh
passwd
• Change your login password.
Syntax:
passwd
passwd <username>
Example:
% passwd is-05
date
• Displays dates in various formats
Example :
% date (in IST)
% date -u ( in GMT )
clear
• To clear the screen
Syntax:
% clear OR,
ctrl + L
alias
• Defines a new name for a command
Syntax:
alias <newcommand>='<oldcommand>'
Example:
% alias dt='date'
% dt
history
• Display a history of recently used commands
Syntax:
history <option>
Example:
%history 10
exit/logout
• Exit from your login session.
Example :
% exit
% logout
shutdown
• Causes system to shutdown or reboot
• May require super-user privileges
Example:
% shutdown -h now ( stop )
% shutdown -r now ( reboot )
File Management Commands
ls
• Lists directory contents
Syntax:
ls <option>
Examples:
% ls (lists all files except those starting with a “.”)
% ls –a
% ls –l
% ls -al
cat
• Takes a copy of a file and sends it to the
standard output
Syntax:
cat <filename>
Example:
% cat link.txt
more
• Display contents of large files page by
page or scroll line by line up and down.
Syntax:
more <option> <filename>
Examples:
% more –a.txt (press enter to see next page content)
% more -s a.txt (squeeze multiple space line into single)
less
• It is used for search navigation.
Syntax:
open the file with
% less <filename> then at end of file
Example:
/<pattern> (want to search)-Forward
?<pattern> (want to search)-Forward
cp
• Copies files/directories
Syntax:
% cp [options] <source> <destination>
Example:
% cp a.txt b.txt