Useful FreeBSD/UNIX commands

Useful FreeBSD/UNIX commands:

#pwd                Present Working Directory
#uptime             Server UpTime stats & operation                
#df                    Disk Free space
#w                   Who is logged on & server info
#who                WHO is logged on and IP address
#last                 LAST users logged on and statuses
#ac                 ACcounting of total time logged on
#top                TOP processes currently executing listed per CPU time
#ps aux
#ps ax
#uname -a
#env                Shows current environment variables, including user & path
#set
#netstat
#trafshow
#cd                 Change the Directory that you are working in
#man                Show the MANual pages for a program
#tail -300 maillog  Show the TAILend of the 'maillog' file -- last 300 lines
#kill -9 PID        KILLs a specific process # (PID), non-catchable, non-ignorable (-9)
#shutdown -r now    ShutDown the computer, then reboot, immediately
#id
#hostname
#vmstat -w 5
#vmstat boot
#more               Display a file, showing a page at a time. Show MORE by hitting 'space'.
#head
#tail
#ls -lt             LiSt (-l with L_ots of info) (-t sort by time)
#ls -laTFWi         LisT all info
#pwd
#users              Shows which users are logged on using shell / command line
pkg_info           List the packages installed                
pkg_add            Add a package
ftp ftp.gnu.org    connects to ftp site ftp.gnu.org
Ctrl-C              Cancel operation
Ctrl-S               Pause operation
Alt-F1              Alternate to the 1st terminal window when using 'shell'
Alt-F2              Alternate to the 2nd terminal window when using 'shell'

FIND (starting in root dir) "nameoffile" or anything begining with that
#find / -name "name_of_file*"
       
FIND files modified within last day:
#find / -mtime -1 -print

FIND files modified over 5 days ago:
#find / -mtime +5 -print

Compress a log file, then mail as an attachment
#gzip -c access_log.processed -v > access_log.processed.gz; ls -lt        
#uuencode access_log.processed.gz DOMAIN.com.log.gz | mail -s "DOMAIN.com Log File" SomeEmail@xyz.com        
Or inline:

#mail -s "Some Text File" email@domain.com < file.log

LiSt files with all info R = recurse subdirs.  Takes 3 hours!
#ls -laTFWiR

Change the owner to 'userowner' of directory 'somedirectory'
#chown userowner somedirectory

Show brief statistics about qmail
#/usr/local/psa/qmail/bin/qmail-qstat

Show the summary info for EACH email in qmail queue
#/usr/local/psa/qmail/bin/qmail-qread

No comments: