cool unix commands

Nov 14, 01:57 AM

free; ## memory left 2019-08-14
free -m;
pstree; ## 2019-08-14

  1. show the size of each directory in gigabytes: (2014-03-09)
    for x in $(ls -1); do du -sh —block-size=1G $x; done | sort -nr | head -10 ;

chkconfig —add red5 ; ## add the RED5 service to chkconfig
chkconfig red5 on ; ## chkconfig that red5 should start asap when booting

strings – displays only printable strings in a binary file (2013-02-06)

nohup – nohangup – starts a process but does not terminate it once we log out (2013-02-05)

top -c ## monitors server processes 2013-01-29
sending mail from bash: 2013-01-25

  1. mail -s ‘TEST TEST Test Subject here’ \ -r mark@edwardsmark.com \ info@comptonpeslonline.com < line one
    line two
    END

script to auto-run ftp from cron: 2013-01-18

#! /bin/bash

  1. -i turn off prompting during mget
  2. -n inhibit auto-login
  3. -v verbose
  4. lcd – i think ftp gets confused where it is
    /usr/bin/ftp -inv edwardsmarkf.com < user mark jabberwalky
    binary
    lcd /var/www/domains/comptonpeslonline.com/
    put ./x.x
    bye
    ENDFTP

#

to restart mysql 2013-01-20
/etc/init.d/mysqld restart

ldd —version ; ## 2012-01-14 – used to display the glibc version

linux has zip and unzip to match winzip! 2010-08-22

find / -size +100M -exec ls -l {} \; 2>/dev/null ;
  1. only show files larger than 100 megabytes (2013-01-07)
  1. du -a /var | sort -n -r | head -n 10 ; ## find the top 10 largest directories

to copy an entire directory: (2009-11-14)
cp -r ./www ./www-SAVE

and another way: tar -cf – $filename | (cd ; tar -xvf -) 2010-04-27 (author unknown)

host – similar command to whois.net: (2009-11-14 – learned from westhost)
host -t mx englishwithoutaccent.com

how to get the size of a directory:
du -k ./html | tail -2;
find . -size +1024 –print

how to get an external zip file and unpack it: (from westhost)
curl http://X.org/X.tar.gz |tar -xzv —strip-components=1

how to “create” a tar file:
tar -cvvf home.tar home/

Mark Edwards

,

---

Commenting is closed for this article.

---