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/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
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:
watch -n 3 -d free
watch -d cat /proc/meminfo
CPU intensive process
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 -fDisk Storage
************************************
iostat -d 3, iostat 2 15
iostat -xd 10sorting 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
init process determines which runlevel it should be /etc/inittab
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
# 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
passwd oracle
chown
clear
TAR – backup / restore
tar -cf myfiles.tar *.trc (create)
tar xvf myfiles.tar (extract)
To create new directory
mkdir target_director |
To copy an entire folder (directory tree) in Linux
1
|
cp -ap /var/lib/mysql /mnt/mysql -ap for same permission as source |
For checking the size of current folder
du -ch | grep total |
To find the size of the hdd
1
|
just enter df |
To find out the size of the folder in the folder
du du -a to show all the file's size |
See all files and their size
du -s * -h |
To output the number of files in the current directory
1
|
ls | wc -l |
See all the jobs
ps -aux |
To find out RAM size on Linux machine
free |
Rename folder/filename
mv test hope mv *.rtf *.txt |
To find which process is consuming how much RAM?
top |
To see the free ram memory
free -m |
To update yum using corn
21 *** usr/bin/yum -y update |
Create tar.gz file
tar czvf myfolder.tar.gz abcfolder/ |
Untar a tar file
tar czvf myfolder.tar.gz abcfolder/
[/sourcecode]
Delete bash History
Try to delete the content of ~/.bash_history
To add new user
* Adding a new user (useradd)
* Modifying an existing user (usermod)
Options:
* -d home directory
* -s starting program (shell)
* -p password
* -g (primary group assigned to the users)
* -G (Other groups the user belongs to)
* -m (Create the user’s home directory
useradd -gusers -Gmgmt -s/bin/shell -pass -d/home/jambura -m jambura |
User’s home directory should be 700. If you are operating a ~username type server, the public_html directory should be 777. You may also need to open up the home directory to 755.
useradd -s/bin/bash -pass -d/imp/sysbsd -m sysbsd |
For allowing sudo
sudo adduser jambura admin |
To delete user
userdel user |
To display your crontab file
crontab -l |
root can view any users crontab file by adding “-u username”
crontab -u bappy -l # List bappy's crontab file. |
tar tvf myfiles.tar (show the details)
Recent Comments