List Directory Contents with permissions
[ahmed@Linux ~] $ ll [ahmed@Linux ~] $ ls –al
List Directory contents with their estimated space usage in human readable format
[ahmed@Linux ~] $ du -ach --mac-depth=1 /home/oracle
Clear Shell Screen
[ahmed@Linux ~] $ clear
Top memory process
[ahmed@Linux ~] $ top (Press shift + m by sorting memory descending)
Check who is in shell
[ahmed@Linux ~] $ who [ahmed@Linux ~] $ w
Force logout user
[ahmed@Linux ~] $ pkill –KILL –u ahmed
Kill process which user is using
[ahmed@Linux ~] $ w [ahmed@Linux ~] $ ps –u ahmed [ahmed@Linux ~] $ kill -9 3922 (where 3922 is PID of soffice process)
Check all services
[ahmed@Linux ~] $ sudo /sbin/service --status-all
Check individual service
[ahmed@Linux ~] $ sudo /sbin/service httpd status [ahmed@Linux ~] $ sudo /sbin service mysqld status
Check logs
[ahmed@Linux ~] $ sudo tail /var/log/messages [ahmed@Linux ~] $ sudo tail /var/log/secure [ahmed@Linux ~] $ sudo tail /var/log/httpd/error_log
Check quota
[ahmed@Linux ~] $sudo tail /usr/sbin/repquota –a
Netstat
[ahmed@Linux ~] $netstat -tunlp (lists the ports and which program & PID has it open) -t = tcp -u = udp -n = display port numbers not names -l = only listening programs (ie: servers) -p = display PID/program name
List open files
[ahmed@Linux ~] $lsof -i [ahmed@Linux ~] $ lsof -p ProcessID
Check Process
[ahmed@Linux ~] $ pstree [ahmed@Linux ~] $ ps aux [ahmed@Linux ~] $ ps aux | grep daemon
• To show all processes running on your system, at prompt, type the following
[ahmed@Linux ~] $ ps –ef [ahmed@Linux ~] $ ps –ef | pg [ahmed@Linux ~] $ ps gv
• Table Description
USER User login name PID Process ID PPID Parent Process ID C CPU utilization of process STIME Start time of process TTY Controlling workstation for the process TIME Total execution time for the process CMD Command
Kill Process
[ahmed@Linux ~] $sudo kill -9 ProcessID
Check which IP is being blocked by tcpwrapper
[ahmed@Linux ~] $ cat /etc/hosts.deny [ahmed@Linux ~] $ sudo vi /etc/hosts.deny (removing blocked ip) [ahmed@Linux ~] $ sudo vi /etc/hosts.allow (adding trusted ip)
Check manual of program
[ahmed@Linux ~] $man man [ahmed@Linux ~] $ man sendmail
Locating another command or program
[ahmed@Linux ~] $ whereis Mail [ahmed@Linux ~] $ whatis ls [ahmed@Linux ~] $ updatedb [ahmed@Linux ~] $ locate vi (Note: updated is system database update for locate command. You should run this frequently or add as daily cron job).
Advertisements