USEFUL UNIX COMMANDS
COMMAND |
DESCRIPTION
|
OUTPUT
|
Ctrl-s
|
Stops scrolling display
|
|
Ctrl-q
|
Rusume scrolling display
|
|
Ctrl-u
|
Kills the current line |
|
Ctrl-d
or exit
|
Logout from unix
|
|
passwd
|
To change the password
|
|
who
|
People who are currently in use
-H - Gives heading
-u -
detailed list
|
|
w
|
More detailed output of the users
with system details
|
|
who
am i
|
Gives your own username
|
|
tty
|
Gives the terminal name
|
/dev/tty01
|
echo
$SHELL
|
Gives the shell name . SHELL is the system variable
|
csh or ksh etc
|
echo
$TERM
|
Gives the terminal name . TERM is system variable
|
ansi
|
set
|
Displays the environment
|
|
cat
|
Displays the
contents of a file
|
|
kill
|
Kills any user
|
|
Ctrl-z
|
To suspend job temporarily and to
execute another job
|
|
fg
|
To resume the suspended job
|
|
Ctrl-z
or ctrl-m
|
Enter key
|
|
Ctrl-@
|
End of line (eol)
|
|
Ctrl-c
or delete
|
To interrupt the program |
|
stty
|
Sets the terminal characters
sane - resume
sanity if the terminal behaves erotically
-a -
displays the current settings.
-echo - turns of the
keyboard input(ex:password entry)
echo - to turn on
the keyboard input.
intr
\^c -
changes the interrupt key
eof
\^a
- changes the end-of-file key from ctrl-d
|
|
Ctrl-h
|
Backspace
|
|
Ctrl-\
|
Kills running command but creates
a core file containing the memory image of the program
|
|
mkdir
|
Creating a directory
|
|
ls
|
Listing files and directories
-
l
long listing
|
|
pwd
|
Present working directory
|
|
cd
|
Change directory
|
|
wc
|
Gives lines words and charaters
-
- l gives no of
lines
-
- c gives no of
characters
-
- w gives no of
words
|
|
Chmod
777
|
To change the permissions of files
/ directories
|
COMMAND |
DESCRIPTION
|
OUTPUT
|
grep |
Looks for a pattern
|
|
type
ls
|
Gives the location of the ‘ls’
– (for
external command)
|
/bin/ls
|
sed
|
Performs a substituition in the
file
|
|
type
echo
|
Will not show the location
(for internal command)
|
Built in
|
;
|
To combine the unix commands ex :
who;ls –l
|
|
cut
–d: -f7
|
Cuts the fields
-d means delimeter here :
-f7 meand 7 the field
|
|
pr
+5
|
Prints from page 5 of the file
|
|
dd
if=raj.txt of=/dev/rStp0
|
Disk dump here
If =
is the input file
Of
= destination(ctridge 4 gb)
|
|
>
|
Second prompt
|
|
uname |
Gives the machine name
|
SCO_SV
|
uname
–r
|
Gives the version Unix system =
ver(in Dos)
|
3.2
|
man
|
Gives the help for the command
|
|
pg
|
Page wise
|
|
more
|
[spacebar]
or f - Next page
10f - Skip 10 pages
1000s
- Skip 1000 lines
b - Back to
previous page
15b
- Skip back 15 pages
/raj
- Searches for ‘raj’
n - Repeat search
.(dot)
- Repeat last command
q - Quit
h - View help
|
|
less
|
[spacebar]
or f - Next page
1000z
- Sets window to 1000
lines
b - Back to
previous page
p
or 1G - First page
/raj
- Searches for ‘raj’
n
- Repeat search
q - Quit
h - View help
|
|
info
|
[Enter]
- Next level
u - Return to
previous level
[spacebar]
or f - Next page
[delete]
or [backspace] – Previous page
t - Top most
node
n
- Next node at
same level
p
- Prev node at
same level
q
- Quit info
h
- View help
|
|
whatis
|
Displays command and purpose only
not syntax
|
|
apropos
|
Displays command and purpose only
not syntax
|
|
lock -
60
minutes
These
are controlled by two settings in the file
/etc/default/lock
on some systems.
|
Sometime you have to be away from
the terminal for a while , nut don’t want to log out because a job is running
in the background. ‘lock’ will locks the terminal and the job will be running
and prevents from gaining access to the system.
It asks for password.
It locks for 30 minutes (by
default)
To restore before 30 minutes you
type
$******* (enter password)
if you are not restoring before
time then it automatically logs out.
|
|
Script
exit
– spool off
|
Spooling the session or
information
-a - appends
to the
|
|
clear
|
Clears the screen
|
|
tput
|
clear
- also clears the screen
cup
10 20 - moves the cursor posn to 10 row 20 col
smso -
starts boldfacing of the entries
rmso -
stops the boldfacing.
|
|
ftp
|
To copy files from a remote
machine
|
|
date
|
Displays the date
+%m -
displays the day
+%h -
displays the month
+%d - day of
the month
+%y - the
last 2 digits of the year
H,M and S for hour,minute and
seconds
|
|
cal
|
Displays the calender for that
month
2000
- displays the total calender of
year-2000
|
|
bc
|
The calculator
scale
2
-Truncates the precisson to 2 decimal places
ibase=2 –converts binary to decimal
ibase=16
–converts hexadecimal to decimal
obase=2 –converts decimal to binary
obase=16
– converts decimal to hexa decimal
|
Tags:
Linux