Pages

Monday, June 25, 2012

Use Full Commands 1


Here is a List of use full commands that can used be used on linux. This page will be updated continuously with commands,

Find The MAC Address  
[root@vx111a test]# cat /sys/class/net/eth0/address
00:25:64:b3:19:fd

Find The Command Line Of the Process Using Specific Port
cat /proc/$(lsof -ti:631)/cmdline

Ping a Host Using Specific Interface ( Or can check Internet Connection for an Interface)
ping -I eth0 www.yahoo.com

Differences between 2 files on 2 different Hosts
diff <(ssh dbs001 cat /etc/apt/sources.list) <(ssh dbs002 cat /etc/apt/sources.list)

Scp To transfer a File
Scp  /root/file1 root@10.5.11.193:.
‘.’ Says to the root folder. You can use /tmp or any thing to copy to a specific location

Delete a File
Unlink fileName

Describe a Command
[root@vx111a ~]$ type ls
ls is aliased to `ls --color=tty'

Show colors assigned to directories
[root@vx11a ~]$ dircolors
LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;0
1:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:
*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*
.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=
01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:
*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:
export LS_COLORS

UUID for Hardisk
[root@vx111a ~]# ls /dev/disk/
by-id  by-label  by-path  by-uuid

[root@vx111a ~]# ls /dev/disk/by-id/
scsi-SATA_ST3320418AS_9VM6N3ZL         scsi-SATA_ST3320418AS_9VM6N3ZL-part11scsi-SATA_ST3320418AS_9VM6N3ZL-part6  scsi-SATA_ST3320418AS_9VM6N3ZL-part9
scsi-SATA_ST3320418AS_9VM6N3ZL-part10  scsi-SATA_ST3320418AS_9VM6N3ZL-part2

[root@vx111a ~]# ls /dev/disk/by-uuid/
10ebe17b-73b7-4222-bd0a-dc67e7b5002e  1d4cd06a-fc44-481f-9d3e-30028937acff  8674853774852B4F
bb20b35b-c0a4-41d5-920c-651f4f25c1e3
1441b1a8-6545-42b7-8509-a1e0735731fb  50F268E7F268D330                      9e8dad18-2019-4dc0-accf-
bd177ac8e0d  e631b874-c545-4732-bf49-4e8bb092d798

DMI table Decoder
[root@vx111a ~]# dmidecode -type bios
Invalid type keyword: ype
Valid type keywords are:
  bios
  system
  baseboard
  chassis
  processor
  memory
  cache
  connector
  slot

ex: dmidecode –type memory : Prints memory relegated things

Last Reboot Information
[root@vx111a ~]# last reboot
reboot   system boot  2.6.18-238.el5   Mon Jul 30 12:44          (06:45)   
reboot   system boot  2.6.18-238.el5   Fri Jul 27 12:39          (06:36)   
reboot   system boot  2.6.18-238.el5   Thu Jul 26 13:38          (06:59)   
reboot   system boot  2.6.18-238.el5   Fri Jul 20 13:03          (06:29)   

wtmp begins Tue Jul  3 15:22:01 2012