User Guides Getting your way around linux in shell

why? because its fast and putty is an awesome tool :) GUI is for noobs :p

Getting your way around linux

Find details about the system
Code:
[root@MaxRepOS ~]# uname -r
2.6.32-279.22.1.0.2.el6.x86_64
[root@MaxRepOS ~]# uname -a
Linux MaxRepOS 2.6.32-279.22.1.0.2.el6.x86_64 #1 SMP Mon Feb 17 00:19:26 PST 2014 x86_64 x86_64 x86_64 GNU/Linux

Which linux is it anyways?
Code:
[root@MaxRepOS ~]# ls /etc/*-release
/etc/oracle-release  /etc/redhat-release  /etc/system-release
[root@MaxRepOS ~]# cat /etc/*-release
Oracle Linux Server release 6.3
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Oracle Linux Server release 6.3

How many RAMs?
Code:
cat /proc/meminfo

How many GHz?
Code:
cat /proc/cpuinfo

Storage real estate??
Code:
cat /proc/mounts
or
mount

Disk usage of mounted file systems
Code:
[root@MaxRepOS ~]# df -kh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/3600508e000000000ab19d6de8bea280fp1
                      444G  3.0G  418G   1% /
tmpfs                  32G   20K   32G   1% /dev/shm
/dev/mapper/3600508e0000000009076d213344a250cp1
                      550G  432M  521G   1% /home
/dev/mapper/3600508e000000000ab19d6de8bea280fp2
                       75G  180M   71G   1% /var/crash

size of files and folders
Code:
[root@MaxRepOS ~]# du -sh *

you all know 'ls -lh' right?

list all block devices (hdds)

Code:
[root@MaxRepOS ~]# lsblk

list all cpus

Code:
[root@MaxRepOS ~]# lscpu

list all usb devices
Code:
[root@MaxRepOS ~]# lsusb

list all scsi devices
Code:
[root@MaxRepOS ~]# lsscsi
[0:0:0:0]  disk  HITACHI  H106060SDSUN600G A2B0  -
[0:0:1:0]  disk  HITACHI  H106060SDSUN600G A2B0  -
[0:0:2:0]  disk  HITACHI  H106060SDSUN600G A2B0  -
[0:0:3:0]  disk  HITACHI  H106060SDSUN600G A2B0  -
[0:1:0:0]  disk  LSI  Logical Volume  3000  /dev/sdb
[0:1:1:0]  disk  LSI  Logical Volume  3000  /dev/sda

List all pci devices
Code:
[root@MaxRepOS ~]# lspci

check a process id and other details
Code:
ps -ef | grep http

find a specific process and its threads
Code:
ps -eLf | grep http

Kill the bugger
Code:
[root@MaxRepOS ~]# pkill httpd

find the pid of httpd
Code:
[root@MaxRepOS ~]# pgrep httpd

annihilate httpd
Code:
[root@MaxRepOS ~]# kill -9 `pgrep httpd`

Network information
Code:
[root@MaxRepOS ~]# ifconfig

starting and stopping a service
Code:
/etc/init.d/httpd (start|stop|restart|status)
[root@MaxRepOS ~]# /etc/init.d/httpd status
httpd (pid  4574) is running...

network port stat
Code:
[root@MaxRepOS ~]# netstat -apn | grep httpd
tcp  0  0 :::8080  :::*  LISTEN  4574/httpd
tcp  0  0 :::80  :::*  LISTEN  4574/httpd
tcp  0  0 :::443  :::*  LISTEN  4574/httpd

who is using my_file?
Code:
lsof | grep my_file
 
Last edited:
Back
Top