Home » , » Useful Linux Commands

Useful Linux Commands

Written By 1 on Tuesday, July 3, 2012 | 10:11 PM


To view System Resource Information
uname --help
uname -r
grep model /proc/cpuinfo
grep MemFree /proc/meminfo
sudo -u root lastcomm -f /var/account/pacct
cat /proc/version
# cat /proc/cpuinfo
# cat /proc/meminfo
# cat /proc/zoneinfo
# cat /proc/mounts
cat /etc/redhat-release
grep MemTotal /proc/meminfo
grep SwapTotal /proc/meminfo
df -k /tmp
grep "model name" /proc/cpuinfo
ifconfig (/sbin/ifconfig)
uaname -r
lshal:detected hardware
rpm -qa:  display pakage
rpm -qa | less
Linux Kernel Information:
cat /etc/sysctl.conf
cat /etc/hosts
/sbin/ifconfig
Uname -r
cat /etc/security/limits.conf
cat /proc/sys/kernel/sem
cat /proc/sys/kernel/shmmax
cat /proc/sys/kernel/shmall
cat /proc/sys/kernel/shmmni
cat /proc/sys/fs/file-max
cat /proc/sys/net/ipv4/ip_local_port_range
/sbin/lsmod
cat /etc/issue
sysctl -a | grep shm
sysctl -a | grep ip_local_port_range
/etc/inittab:  init process determines which runlevel it should be 
w, ps -a, ps -Alf, ps -AlFH, ps -AlLm
ps -u oracle, ps -u anguyen
Commands to monitor bottlenecks such as Disk, Memory / CPU/Network, or System Activity:
top ? t, m, A: top consumer, r: renice, o: interactively select
vmstat 3, vmstat -m:memority slab info, vmstat -a
w, ps -a, ps -Alf, ps -AlFH, ps -AlLm
ps -u oracle, ps -u attunity
uptime
free
fee -s 2
watch -n 3 -d free
watch -d cat /proc/meminfo
sar -B -f /var/log/sa/sa14
sar -W -f /var/log/sa/sa14
vmstat -m
vmstat -a
ipcs -sm
ipcs -lms
sar -n DEV | more
sar 4 5
mpstat -P ALL
MEMORY intensive process:
ps -e -o pmem,pid,user,tty,args | grep -i oracle | sort -n -k 1 -r | head
watch -n 3 -d free
watch -d cat /proc/meminfo
CPU intensive process
top
ps -e -o pcpu,pid,user,tty,args | sort -n -k 1 -r | head
mpstat -P 0 2 20 (processor 0
mpstat -P ALL
sar -u -f

Disk Storage
************************************
iostat -d 3, iostat 2 15
iostat -xd 10

sorting files by size
***********************
ls -alS | head -5
mpstat -P ALL
sar 4 5
****************************************************
Network
**************************************************
lsmod | grep -i bonding
cat /etc/sysconfig/network-scripts/ifcfg-eth0 (check bonding)..the difference NETWORK, IPADDRESS, NETMASK
netstat -s | less
netstat --interfaces eth0
netstat -ptc
sar -n DEV
netstat -nat | awk '{ print $5}' | cut -d: -f1 | sed -e '/^$/d' | uniq
tcpdump -n -i eth1 -s 0 -w output.txt src or dst port 80
iptraf - Real-time Network Statistics
Network traffic
netstat -ptc
sar -n DEV
sar - Collect and Report System Activity
*************************************************
Oracle
***************************************************
cpio -idmv < 10201_database_linux_x86_64.cpio
id oracle
id nobody
pgrep sshd
env | grep PATH
detected hardware lshal:
init process determines which runlevel it should be /etc/inittab
shutdown
shutdown -t3 -r now
mount /dev/hda4 /data/oracle/bkup1:
 grep ‘Ashley Nguyen’ /etc/passwd
find / -name install.log
sed ‘s/anguyen/lvu/’ /etc/passwd > /tmp/test
ps aux | grep nfs
free: 
Ifconfig -a
To determine the amount of shared memory available, enter the following command:automatic memory management
# df -k /dev/shm/
To determine the distribution and version of Linux installed, enter the following command:
# cat /proc/version
To determine whether the required packages are installed, enter commands similar to the following:
# rpm -q package_name
Add group
# /usr/sbin/groupadd oper
Modify user:  usermod -g oinstall -G dba oracle
Create disks:
fdisk -l
give password to oracle user
passwd oracle
change ownership in linux
chown
clear screen
clear
TAR - backup / restore
tar -cf myfiles.tar *.trc (create)
tar xvf myfiles.tar (extract)
tar tvf myfiles.tar (show the details)

0 Comment:

Post a Comment