recent

Titulo

Linux Command

No one can remember all the Linux commands therefore, dbarepublic has created this page to store all the Linux commands that are frequently or rarely used commands. This page is updated whenever we solve problem using Linux command or utilities. This page lists everything that we have been using for our projects & assignments since year 2000. Remember, this is not a man page instead  a quick command reference to assist anyone with your database administration and development work.

Files:
pbaniya@dbarepublic.com:~ touch filename.txt
pbaniya@dbarepublic.com:~ vi filename.txt
pbaniya@dbarepublic.com:~ cat filename.txt
pbaniya@dbarepublic.com:~ view filename.txt
pbaniya@dbarepublic.com:~ rm filename.txt
pbaniya@dbarepublic.com:~ ls 
pbaniya@dbarepublic.com:~ ls -lrt
pbaniya@dbarepublic.com:~   ls  my*
pbaniya@dbarepublic.com:~ ls -a
pbaniya@dbarepublic.com:~   ls -a | egrep searchfilename.txt  #searching hidden file
pbaniya@dbarepublic.com:~   mv filename .hidefilename.txt     #hidden file
Directories:
pbaniya@dbarepublic.com:~ mkdir directoryname
pbaniya@dbarepublic.com:~ mkdir .hiddendirectory
pbaniya@dbarepublic.com:~ ls directoryname
pbaniya@dbarepublic.com:~ rm foldername        #empty folder
pbaniya@dbarepublic.com:~ rm -rf foldernamer   #folder that contains file 
No Hang Up: <nohup>
pbaniya@dbarepublic.com:~ nohup ./take_backup.ksh &
pbaniya@dbarepublic.com:~ nohup ./take_backup.ksh >spool.txt
pbaniya@dbarepublic.com:~ jobs                  #view background process or jobs
pbaniya@dbarepublic.com:~ fb %job#              #moving jobs from background to foreground
pbaniya@dbarepublic.com:~ ps -a | egrep pbaniya #list all jobs under user pbaniya
pbaniya@dbarepublic.com:~ ctrl + Z              #stops running script
pbaniya@dbarepublic.com:~ bg                    # moves the foreground job to background
No Hang UP:<nohup> SqlPlus Script:
nohup sqlplus username/password@oracledb @query_file.sql &
Head & Tail:
pbaniya@dbarepublic.com:~ head foo.txt          #display first ten lines
pbaniya@dbarepublic.com:~ tail foo.txt          #display last ten lines
pbaniya@dbarepublic.com:~ head -100 foo.txt     #displays first 100 lines
pbaniya@dbarepublic.com:~ tail -50 foo.txt      #displays last 50 lines
Less is More:
pbaniya@dbarepublic.com:~ cat foo.txt | more   #display one page at a time.
pbaniya@dbarepublic.com:~ cat foo.txt | less   #display one page at a time(more advanced)
Who,Which, & Whoami:
pbaniya@dbarepublic.com:~ who                  #who are logged into the system.
pbaniya@dbarepublic.com:~ which ssh            #displays the path of executables
pbaniya@dbarepublic.com:~ whoami               #current user name
Switch User:
pbaniya@dbarepublic.com:~ su username      #login in as substitue user
All User:
pbaniya@dbarepublic.com:~ awk -F ':' '{print $1}' /etc/passwd  #display all the users in the system
Cut:
pbaniya@dbarepublic.com:~  cut -c4 foo.txt     #extract 4th character from each line
pbaniya@dbarepublic.com:~  cut -c4-10 foo.txt  #extract from 4-10th character
pbaniya@dbarepublic.com:~  cut -c4- foo.txt    #extract 4th character to end
pbaniya@dbarepublic.com:~  cut -c-10 foo.txt   #extract start to 10th character
pbaniya@dbarepublic.com:~  cut -d ':' -f1 foo.txt    #extract first field using
pbaniya@dbarepublic.com:~  cut -d ':' -f1,6 foo.txt  #extract first and 6th fields
I/O Redirection:
pbaniya@dbarepublic.com:~ ls -lrt > foo.txt   #append the result to foo.txt
pbaniya@dbarepublic.com:~ ls -lrt >> foo.txt  #writes result to foo.txt with append
pbaniya@dbarepublic.com:~ sort < input.txt    #reads from input.txt
pbaniya@dbarepublic.com:~ sort < input.txt > foo.txt #sorted result to foo.txt
pbaniya@dbarepublic.com:~ sort <input.txt | more     #combines linux command
Linux Version:
pbaniya@dbarepublic.com:~ uname                #linux version
pbaniya@dbarepublic.com:~ uname -r             #linux version
pbaniya@dbarepublic.com:~ uname -a             #linux version
pbaniya@dbarepublic.com:~ cat /proc/version    #linux version
pbaniya@dbarepublic.com:~ lsb_release -a     #linux version
Host Information:
pbaniya@dbarepublic.com:~ hostname            #display host
pbaniya@dbarepublic.com:~ hostname -i         #display ip address
pbaniya@dbarepublic.com:~ hostname -a         #display full hostname
pbaniya@dbarepublic.com:~ cat /etc/hosts      #host files

1 comment

  1. Thanks Prabin, very useful site.

    ReplyDelete

Powered by Blogger.