Basic Commands


Frequently used commands

uname à  to verify OS
uname-r à version info of OS
clear  à to clear the screen
hostname à to know the host name
who à who logged into the box
uptime à when server was up
last -6 reboot à last 6 reboots
last –n reboot à last n reboots
pwd à present working directory
ls –ltr à long list
su àswitch to root user
id àto know a/c
ps  -ef =shows all the running processes
ps –ef  | grep java =shows all the java processes
ps –ef  | grep http  =shows webserves running
grep =search
telnet  hostname of database  port number =to check whether database server is running or not
iostat =disk utilization
vmstat =memory utilization
netstat =ipadress,
hostname =gives current system name
uptime=will show how long the system has been up and also shows cpu load number of users logged in
tar  -cvf<filename to be zipped><path of folder to be zipped>
tar  -xvf<zipped folder name>< path of the folder to which it should be unzipped>
init  0=shut down the system
init  6= to restart  or reboot the system
kill  -3 pid=generate thread dump
kill  -9 pid =kill procees id
tail filename=displays last 10 lines of the file
tail -100f systemout.log=displays last 100lines of systemout.log
head file name=displays first 10line of the file
ls –l=list all the files in the current directory
cat filename=opens the file in read only format
cat>filename=create the file and add data
cat>>filename=to append/update data to the file
touch filename=create file
rm filename=remove file
rm *=removes all the filein the present directory
top =cpu utilization
topas(in aix)=cpu utilization
du –sm =displays disk space utilized in MB
du –sg=displays disk space utilized in GB
du –sk=displays disk space utilized in KB
touch filename1 filename2 ……..=to create multiple files at atime
grep “  E “ systemout.log=search for E error in system out log
grep “ E “ systemout.log | more=displays pageby page(press space for next page)
prtconf=gives complete info about physical machine
prtconf | grep  “mem”=gives memory information about physical information
cmp file1 file2=compares two files
cp= coppy file
scp= secure shell command to copy file
comm file1 file2= check similarity in two file
diff file1 file2= differentiate one from other

fgrep=to search multiple strings/words at atime
chmode àto modify permissions
chown à to change the ownership
chown user1:user1 <filename>
              userid     groupid
grep à pattern search
grep –i <pattern name> <file name>
tar  à archiving utility
tar –xvf <location> <location to be copied>
ping à to check the remote host
telnet à remote server name
df àdisk free
du à disk usage
ps àprocess info
lsof àall processes info
head àfirst lines
tail àlast lines
diff àdifference

ifconfig  -aàip address
netstat àto get port numbers
netstat  -an | grep <port>àto get the process id
. àcurrent working directory
/ àentire root directory

Vi Editor Commands

vi à to open vi editor
vi <file name> à to open the file in vi editor
i àinserting ---right click
esc àto come back to normal command
shift:wq! àexit with saving
shift:q! àexit without saving

Cursor movements in Vi Editor

j àdown, k àup, l àright, h àleft, w àforward right one word,
b àbackward one word, e àwords last letter moves to end of the word,
H àhead top of the screen, M àmiddle of the screen,
L àlast line of the screen
x àremove char
u àundo previous change
X àremove one char left side
dw àremove char end of the word – right side
dd àdeletes all the current line
D àdeletes current line to end
a àcursor will go to insert mode – right side
i àcursor will go to insert mode – left side
yw àcopy the word to buffer
p àbring back after cursor
P àbring back before cursor
yy àcopy whole line to buffor
U àcomplete undo
u àprevious change
r àto replace char
R àit will go to insert mode
o àcreates blank line below the cursor and it will go to insert mode
O àcreates blank line above the cursor and it will go to insert mode.

Comments

Popular posts from this blog

Understanding SSL

Session Management Part-1

WebSphere Application Server