
Terminal - Commands by rockon - 18 results
ps -eo size,pid,user,command --sort -size |awk '{hr[1024**2]="GB";hr[1024]="MB";for (x=1024**3; x>=1024; x/=1024){if ($1>=x){printf ("%-6.2f %s ", $1/x, hr[x]);break}}}{printf ("%-6s %-10s ", $2, $3)}{for (x=4;x<=NF;x++){printf ("%s ",$x)} print ("\n")}'
This is sample output - yours may be different.
1.49 GB 6457 1001 /opt/google/chrome/chrome --type=renderer --lang=en-US --force-fieldtest=CacheListSize/CacheListSize_14/ConnCountImpact/conn_count_6/ConnnectBackupJobs/ConnectBackupJobsEnabled/DnsImpact/default_enabled_prefetch/DnsParallelism/parallel_default/GlobalSdch/global_enable_sdch/IdleSktToImpact/idle_timeout_10/Instant/HiddenExperimentB/Prefetch/ContentPrefetchPrerender2/PrerenderFromOmnibox/OmniboxPrerenderEnabled/PrerenderFromOmniboxHeuristic/ExactFullAlgorithm/ProxyConnectionImpact/proxy_connections_32/SpdyCwnd/cwnd10/SpdyImpact/npn_with_spdy/WarmSocketImpact/warmest_socket/ --extension-process --enable-print-preview --channel=6390.0xb9b71c60.593461523
630.18 MB 2488 1001 /usr/lib/thunderbird-3.1.8/thunderbird-bin
501.08 MB 3426 1001 /usr/lib/firefox-3.6.3/firefox-bin
272.55 MB 11897 1001 /usr/lib/chromium-browser/chromium-browser
Finding high memory usage report in human readable format.
watch -n1 "uptime && ps auxw|grep http|grep -v grep | grep -v watch|wc -l && netstat -ntup|grep :80 |grep ESTABLISHED|wc -l && netstat -ntup|grep :80|grep WAIT|wc -l && free -mo && ps -ylC httpd --sort:rss|tail -3|awk '{print \$8}'"
This is sample output - yours may be different.
load average: 0.11, 0.10, 0.03
39
27
46
total used free shared cached
Mem: 4050 3096 953 202
Swap: 8197 114 8083
HTTP_RSS
2720
2744
3336
In certain cases you mighy need to monitor the server load caused by certain process. For example HTTP, while stress testing apache using ab (apache benchmark) you may want to monitor the server status,load, # of spawned HTTP processes, # of established connections, # of connections in close wait state, apache memory footprint etc.
This is sample output - yours may be different.
This is sample output - yours may be different.
# httpd -M
Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
authn_file_module (shared)
Easiest way to check which modules are loaded in apache.
This is sample output - yours may be different.
# sestatus -v
SELinux status: disabled
Usefule to check whether SELinux is in force or disabled.
Though you need to be superuser while execute this command.
mysqladmin -u root -p extended-status
This is sample output - yours may be different.
| Variable_name | Value |
+-----------------------------------+------------+
| Bytes_received | 39344144 |
| Bytes_sent | 3573644966 |
| Com_admin_commands | 6 |
| Com_delete | 21 |
| Com_insert | 789 |
| Com_show_databases | 1 |
| Com_show_fields | 192 |
| Com_show_status | 188 |
| Com_show_tables | 2 |
Useful when checking MySQL status.
openssl s_client -connect www.example.com:443 > /tmp/example.com.cert
This is sample output - yours may be different.
openssl x509 -in /tmp/example.com.cert -noout -startdate -enddate
notBefore=May 03 18:06:47 2012 GMT
notAfter=May 02 17:28:01 2013 GMT
Useful when we need to create new certificate for site when current one is near expiry.
This downloaded cert can be used to provide organisational data directly to new cert. using below command.
e.g. openssl x509 -x509toreq -in /tmp/example.com.cert -out example.com.csr -signkey example.com-key.pem
This is sample output - yours may be different.
sar -u 2 5
Linux 2.6.27-11-generic (desktop) 03/01/2009 _i686_
09:52:36 PM CPU %user %nice %system %iowait %steal %idle
09:52:38 PM all 10.49 0.00 1.22 0.00 0.00 88.29
09:52:40 PM all 7.80 0.00 0.98 0.00 0.00 91.22
09:52:42 PM all 5.15 0.00 0.25 0.00 0.00 94.61
09:52:44 PM all 6.80 0.00 0.73 0.00 0.00 92.48
q09:52:46 PM all 3.18 0.00 0.73 0.00 0.00 96.09
Average: all 6.69 0.00 0.78 0.00 0.00 92.53
Generated the CPU utilization stats with 5 lines /every 2 seconds.
Needs sysstat package to be installed prior to use sar.
This is sample output - yours may be different.
List the files a process is using.
cp /some/path/to/myfile{,.back}
This is sample output - yours may be different.
cp /some/path/to/myfile{,.back}
ls /some/path/to/
myfile
myfile.back
Copy the file with the given .extension at the source file's location. Eliminates the typing of long paths again and again.
This is sample output - yours may be different.
ethtool -S eth0
NIC statistics:
tx_packets: 749522
rx_packets: 1592722
tx_errors: 0
rx_errors: 0
rx_missed: 0
align_errors: 0
tx_single_collisions: 0
tx_multi_collisions: 0
unicast: 1434950
broadcast: 157515
multicast: 257
tx_aborted: 0
tx_underrun: 0
Traffic details on the Ethernet interface.
bzgrep -i "pattern" pattern.bz2
This is sample output - yours may be different.
bzgrep -i "pattern" pattern.bz2
>This is my pattern.
Search the pattern in bzip2 compressed file with out having to unzip.
This is sample output - yours may be different.
pinky -l xyz
Login name: xyz In real life: xyz xyz
Directory: /home/xyz Shell: /bin/bash
Gives information about user's home directory and real name and shell user is having.
This is sample output - yours may be different.
hdparm -i /dev/sda | grep -i model
Model Number: ST3160815AS
Get the hard disk information with out shutting down and opening the system.
It gives information on model no., serial no., cylinders/heads/sectors, and the supported features of the hard disk.
This is sample output - yours may be different.
lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 8.10
Release: 8.10
Codename: intrepid
To know the OS distro and version, release.
Is same like /etc/redhat-release
This is sample output - yours may be different.
dmidecode | grep -i prod
Product Name: HP dx2480 MT(FX800PA)
Product Name: 0B08h
This command gives a model information of a computer. Also useful in determining the host is a VM machine or actual physical machine.
IPADDR=`ifconfig eth0 | grep -i inet | awk -F: '{print $2}'| awk '{print $1}'`
This is sample output - yours may be different.
IPADDR=`ifconfig | grep -i inet | awk -F: '{print $2}'| awk '{print $1}'`
echo $IPADDR
193.122.18.101
Useful in scripts while you just need an IP address in a variable.
This is sample output - yours may be different.
Deletes thousands of files at one go, I'm not able to recall the exact # of files that rm can delete at one go(apprx. around 7000.)