0% found this document useful (0 votes)
37 views

Linux Commands

Uploaded by

sri nayini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
37 views

Linux Commands

Uploaded by

sri nayini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 8
——— 863=—. UC Q Obthn ie ___ DESCRIPTION IF we type the abv cmmd then it pings infinite Ue 3s to count finite no. of times we use ails of LINUX M/G ystem information 05 information cessor information. To know abou To know To know about p know abou 4 Voth Je us Vithnu. aa OF Mianrela, COMMAND config (or) feontig -@ Jevin/feontig (or) /sbin/itconfig pif ping -c 3 uname a unam | @ To know about cpu ecture information To know about kernel information uname-t a | To know about network information uname -n } To know about system date. uname -v a To know about LINUX version To know about the users _ cat ete/issue (or) cat /etc/redhat-release who (gr} whoami (or) who am be ww who is longed 7 iogname 0 switch to another user Guffor root) & su username(for ather users) To know system date _ date | To know the calander cal | To ciear the screen clear | For claculator, i be To see previous executed commands 1 history Troubleshooting tool in LINUX (Task Manager in LINUX) top {in ESXi-> esxtop) “ai Te kal 3 process kill pid To forcefully kill a process ‘ kill -9 pid To know details about any cmmd_ ‘emmd -h (or).cmmd --help (or) man emma To find all processes Ps. To find all processes in the current shell ps -A (or) ps -e To find all running processes in the current shell ps- To find all the running processes in all the’ shells ps-lef ; To find all processes in all shells ps -eaf ps-eaf | grep top To retrieve all the processes which has top ps-eaf | grep to” To retrieve ail the processes which starts with "to" Til 15 | Uist of files i List of files with detailed description Is Tat of detailed description of files those are matched || {ect | grep LINUX (or) Is-1| grep -ilinux with LINUX ‘ ———————— hd $$ __ is Detailed description of a file given ee Size of a file re s i. ize of a file in human readable format : 7 List of all hidden files et List of al files in detail with human readable format ts-th list of allfiles in detail including hidden files 2 a eee List of all files in reverse order Uist of al files in ascending order (Based on Last Modified Time) List of al files in descending order (Based on Last Rermaneety dletebe 7 Is tr aa a 4 nd = Pe * Oy windows — fase 1 a a * Cpr €ache (a, 1a, wd) § ANCE uve Tist of al files v der Di directory __— List of ail files un‘ under /sbin avec ries under directories Tist of detailed description about which are connecte’ to the pe slots, | F——Fomraw the details about Clogic HBA whichis —— know the details abo Ispei-v | grep “alar* connected to the pci slot__ Lm To know the details about Emulex H8/ ot connected tothepesiot __ Tepcl + | grep "Emus" | HBA is SCSLHBA 01 cat [proc/scsi eave anew directory, em mkdir di) } Create multiple directories at a time mkdirdid2 3 1 Greate multinle directories under another directory at Z q Ras kei -p di/d2/a3 { Change directory todi aes nie out of single cirectory cd. To go to root directly - cdf To go to Desktop, ie ‘ed fhome/user/oesktop | ay To go to Downloads directory cd fhome/user/Downioads, a To know in which directory you are presently working) pwd To create file touch fn : To create a HIDDEN file touch fa. 1 To create multiple files at atime touch f1f2 (3, To create multiple files in multiple directories at a time touch d1/fa d2/f2.62/13 [To know the contents of the file without opening the fie catin = a To know the contents of the file in reverse order withet} tacfn \ opening the file Toedita file vit (or) vitn fn | To overwrite 2 file without opening it . cat > fn (or) echo ad an ‘To append some data to a file without opening it ia >> Infor} echo “st >> | [Tocdelete the content of the file (With out changing fae ae echo ™ > {1 \ size of the file} S| er) fo delete the content of the file {With c the sie) a cat> {r{To exit press ctrtd} \ __of the fle) stat heer | To change permissions of . Thmod 444 fn {reed 4s we ‘execute-i) An Toadd execute permission ‘chmod +x fr. = “of Grown (or) adduser ne> (or) passwd sswd (or) ifconfig ethO/i To change the hostname temporarily - hostname To change IP Ss perm 4 \ge IP address permanently and to add gateway vi Jete/sysconfig/network-seripts/ifefg-etho/1 —# To change the IP address in graphical representation neat To change the services jetclinit.d/cservice_name> To change the services service | ee vi fete/ssh/ssh_config | To list all services page by page Saar aESll | Where do we find all services? under Jeté/init.d | ¥ ‘Where do we find all run-level services??? run-leveld -> /etc/re.d/rc0.d | 4 Where do we find init runlevels??? Tetefinittab pee Taeu/had{non-SCsI disks) /dev/sda(SCsl, SAS supported | disks) To get IP address 2 dhclient To get detailed description of each and every services Is-l/etefinitd To know abt system statistics aysstat To know abt network statistics netstat is used by networkor | To know whether the port ae is used by netwi be ene 7 } o To know abt lO statistics iostat Tist of system configuration files Is /etc/sysconfig To know about system configuration, setup, control a information ; To get MAC{Machine Acess Code) address ifconfig-a | grep -ihw Tro get MACIMachine Acess Code) address © | erep-| "hw" Jetc/sysconfig/network-scripts/ifcfg-etho To get only IPV-A and IPV-6 address _* eonfig-a | grep addr To restart a process a HUP -ipid To display no. of word, chars, bytes, lines count of a file 4 a} To display no. of characters in a file we-cin To display no. of bytes of a file ce we-m fo To display no. of words in a file we-w fn To display no. of lines in a file we-l fn To display lengt’» af large line in a file fe we-Lin To display no. of words, chars, bytes, lines count ofall — the files in the current directory To display no. of words, chars, bytes linescount ofall ag the files in the format of in the current directory, ‘ ta | J ee iy vitn +27 Infn /home/user/Desktop/jh_hrdink [___Tocreate a hard link to a file_ To create a soft link toa fle |RSS aise Beso sk To display passwords {Those are in encryptee format) | | cat /etc/passwd (or) cat /etc/shadow | ___"/iitahial date hditay | To display first 10 ines of a le head in it __Todisplay first § lines of afile_— Peet UES FH slay last 101 +— tailfn el atl To display last 10 lines of afile___—} fo 2 Totispiny last 5 lines of a Te a | To display 4-8 lines of 2 file__—~ === _ 638 fr | tall -$ fn ract some | om one file and append ther {0 | me lines from one fil P | head -8 fn | tail -5 fr >> fi another file a Eon f oy ‘0 know the pid of any service | pidofservice (01) parep < igenom servi Yep alyenv! | TogetiProutingtables Tae ee bgt [|___ Tosee the path set in LINUX mic SPATH | | To ne path set in LINUX M/C without any 2) ings echo $PATH | | Par ! echo "WELCOME" |< To print whatever we want To know where is perl /python/ sh(shell) located © ‘which perl (or) which python (or) which sh | { To know the alias name of Is command which Is 1 i How to give alias name e alias Is ='ls ~color = auto’ | | To install device drivers insmod i Where do modules are located? 1s /libmodules \ a Tist of all modules A ismod (or) modprobe 2 tailed description of all modules 4 15-1 /lib/modules | To probing (finding) @ particular module Tnouprobe -f ‘modprobe -| grep raid Wel a To find the path of the RAID module FE To create RAID volume Tadadm help (managing disk administrator) fer the last done process is executed or pa ee esaaes not "To know the information about memory cat /proc/meminfo ip To know the inactive memory ‘eat /proc/meminfo | grep "Inat | To know the information about cpu ‘cat /procfepuinfo [jo now whether the underlying hardware is 64-bit oF cat /proc/epuinio/ | erep Im | 32-bit E To kaow the information about SCSI eat (proc/scsi/ses i 7 cat /proc/scsi/ala z Te know whether the scsi is Qlogiescsi_ Tene “To know whather the'scsl is Emulex scsi > cat /proc/scs To know HBA (or) FC WWPN port no. IEwe have 2 ports, cat /proc/sesi/Qla i he detail t fre __itgives the detalls of those 2 ports hal a To display all devices al 5 oa aay is /var/low 5 eee re. i ar/iog/dmess. mel 4 isp pc oe a ec ving messages rec Penrirwares ere ; pas. ignoring the case o) | arlog tna aor ning messages of hitp error logy JT a toa file and corrupts a fle [7 aman jeip f1 213 Topi the diferenes inthe fies pile ae ie To zip files ‘unzip file.2iP -_ TS naip a zipped Me} zip Di/ To ip a directory gp fi (213. To guncip files "To unaip gunzip fles fies 5 To check mdSsum of a file 2 print the data of two files Next (Paste) | |__To know from how long the M/C is ee ae - Wee bE To untar a tar file ———___o zip-tar files on To know the free space, what is the memory used & —To unzip-untar a filetarge To tara directory | To tar.all files starts with f To know about driver messages and boot moss ages ‘details + To know about internal harch alte “tar oxvt filetar tar -cavl file.tar gz {1 (2 13 tar servi file.tar gz tor-evf O1.tar 01/ tar-cvf fil.tar fit md5sum paste f112 eS uptime _ | swap size free To reboot my M/C be oot To shut down the M/C after particular time Tanown time To sleep the M/C after particular time sleep time To trace the path of remote M/C’s, tracepath To know how many hubs, switches,routers, gateways and servers are lying in b/w my M/C & remote M/C traceroute ‘fap etho (or) ifconfig etho up | ak | | To bring up the first NIC (Network Interface Card) To bring down the first NIC (Network Interface Card) ifdown eth0 (or) ifconfig ethO down [Te know file space, major partitions and disk used at Ba e Disk level To know file space, major partitions and disk used in df-h Af -i o> free |inodes human readable format at Disk level | To know used space in the current directory level au du-h To know used space in human readable in the current directory level . Sep flei root@:/disk3/D3/file2 cd To copy a file from your M/C to remote M/C scp -t PythonProgms/ root@:/MyPrograms To copy a directory from my M/C to remote M/C, winsep_ To copy a file from windows M/C to LINUX M/C To login to the remote M/C To execute a query in remote m/c How do you login to remote M/C Without using password? ‘ssh root@ ‘ssh root@ ‘ifconfig -a' By using public keys. ssh-keygen -t fsa the keys can be found under /root/.ssh/id-rsa.pub To generate a public key Where do the keys are stored? To add my M/C key as ‘authorized key in remote from my M/C To add remote M/C's key as authorized key in MY nye from remote M/C m/c ° To make changes in !? Routing Tables To find the path of a file To find the file is modified in last § min or not To find the file is modified in last 2 days of not | Ne es eee ae When u chng ur hstrme, u shid do changes in this le {E To schedule the time for some program execution. To mount nfs/cifs type share a 1 cat /root/.ssh/id-rsa,pub | ssh root@ ‘cat >> ‘Todind the log fles which are modined Aaa acne ed Trifwe try 2 connect 2a hist & itis saying unable 2 resolve d «ssh/authorized_keys' “rat [root/ ssh/id-rsa.pub | ssh root@ ‘cat >> _ssh/authorized_ keys’ vi/etc/init.d/iptables find /Disk2 -name "filed.tar" Tind /Disk2 -name “filel.tar” -mmin +5 time +2 find /Disk2 -name “file1.tat find /var/log -name "*.og" -mtime +30 cron job mount +t nfs : / /edir_nm(2 whch uwnt 2 mnt dis shr> a 5 a ee aj Tom -s/ //proc/scsi/sest [>———————sx from Ses Dhan ‘echo “scsladd-tingle-device To rescan a disk from host si_host/hosto/scan_ jon for UINUX partitions s — : the sector size of the disk Specify no. of cylinders of the disk is When listing partition tables, gives size in 5 a _oylinders } is any svnbarlymewy Tounded disk and ha I To do PARTITION fdisk (/dev/sdu) i tm) (help) it lists all the options I n Create new partition Choose = 1 2 Primary partition | Ce) Extended partition | Choose Cylinders | (a) 7. (Print) To see what and how it comes = ee ‘Write and exit | “Some other available options are: q | (a) Delete partition (ca) Quit (or) Exit | Once the partition is completed we need to format ‘the disk by using ext2 or ext filesystems to use that gi + To create ext2 or ext3 filesystem mkezis mkfs.ext3 To create ext3 filesystem To convert ext3 to ext4 filesystem. Jo mount that formatted disk space toa directory r The mounted space is not permanent. To make it vi/ete/fstab | permanent we should update it to a file. To list all mounts: Command used to part more than 273 parted Sam pm-spatagerm iit adage nS — + To uninstall a package Ttune2fs mount / / mount +1 rpm -evh package, 1pm -q package m To query about @ package whether its installed or nok | « To know about the package Tpm -m package.roM T To know about all the packages tpm=qa pakagespm te Modifier} [Toingtall a package we can alsouse __ um packagename (Yelowrlog Upt=ss A if you know ipaddress or hostname it gives you domain nslookup Gn ur dskip itu wnt to know the IP address, it gives you (Fully Qualified domain Name) the IP address To execute the files before the M/C comes up. (rc.local i vi fetc/re.local 2 configuration file where you need to do changes) “Some VM commands can be done by loging into vSphere client to connect to an ESXi server _ To get list of all VM's and VM-ID ‘To power-on a VM To power-off a VM cd /vmfs/volumes SS 7 fees NU ~~ WINDOWS. pe es eae “Windows is heavy 08 Unux has more stability 4 ig Linux is faster Less M/C’s run on Linux, coz Linux uses ———" More M/C’s run on Windor Enterprise level sophstated vl apnea fraps pst Ive apes eT more on Linux on Windows jows is more successful, coz its usability ‘BSOD (Blue Screen Of Death) —RICROSOFT WINDOWS is a SCRIES of GRAPHICAL indows has less stability, coz it has more graphics Windows is slower Linux is less successful, compared to Windows PSOD (Purple Screen Of Death) UNL | | UNUX isa UNIX-LIKE & POSIX COMPLIANT computer os INTERFACE os __linux can be freely distribured It costs eT Linux kernel is developed by community Developed by Microsoft Supported filesystems - EXT2 (Extended File System), | Supported file systems :- FAT (File Allocation Table), EXT, EXT4, NTFS, FAT, FAT32 a FATS2, NTFS(New Technology File System) User interface :- Gnome (or) KDE User interface :- Graphical Dos-like commands, recently there is an additional option ‘Command type :- BASH( i ype = BASH (Bourne Again shell) | TF po wensHELL that uses more UNIKlke commands 05 type = GNU(GNU's Not Unix) (OS type = DOS Programmed in C Programmed in C, C++, Assembly We can connect to Linux to Windows We can connect to Windows to Linux To know about detailed details of the user finger Want to dsplay the user's login name, realname, i ee a terminal name and write status j itis used to download the file weet file Z ‘apt-get install To install any module we ean also use tall {pip install math) In PYTHON to install any modules/packages we use pip i part -a (partx -a /dew/sdb/} ‘unmount Toupdate the partition table To unmount the space given from the directory jet ete Rpadaver fineent / nowadnntes —z Fane a mesh 7 t Lae td s Be on /rmont [moose FOP Se eon he we ih é i) lian me vedo ad ce ie ge > downle: bak aw og! Zink 7 I ie tice : Sao «VO a ec ssh yok @ © Heel © sth he eo ‘atone a gmecupaelt. ats alae “rep year muerng s esttop —7 ES" ; an Wonders . Sug Vine ko Jo shel 18 § Adm uses uh ev) mcd pevledtots i 3 est jderon ate host Seng Bee yet toi /Ne prea ie' 124 §xformation ee? “feat 12 Hired en ee LR nen 7 oh ok nie if ope oT 4 ‘ eg u % cee as? eee. fo vp ed ager! fe Hs Mi ra. log cee ges ie mt . cpus np Phe: esvany eles Secondeny Soraper Ge gtd feet | Srame Pile ffolees ia —wntime = Pays as aa Bet ae _mmin - Sostat -— TO Check Soy Stas BCS of fo'e ap _ce ic Asivess i Raid cc pach — avodinrte Cay Mer bojpa.we Chie yee pi — Madfrfo te snp 3 Sas chav Soles Chect ver son ° for © mver? Ude a fpab! Fb -Slarep "," Tee Berea! distlaey caw Blea 19 9 AB > te Brea py duce weg fn ROS:

You might also like