Nice blog entry detailing: pgrep, pstree, bc, split, nl, mkfifo, ldd, col, lsof, xmlwf
I also want to go on record that I HAVE used 5 of them.
Nice blog entry detailing: pgrep, pstree, bc, split, nl, mkfifo, ldd, col, lsof, xmlwf
I also want to go on record that I HAVE used 5 of them.
* * * * * command to be executed - - - - - | | | | | | | | | ----- day of week (0 - 6) (Sunday=0) | | | ------- month (1 - 12) | | --------- day of month (1 - 31) | ----------- hour (0 - 23) ------------- min (0 - 59)
Try these commands to get hardware info:
prtconf
vmstat
dmesg
Here is a link disussuing using TOP to create performance snapshots and other tips.
You can use PERL as a stream editor to replace strings in one or more files in a directory like this:
perl -pi.orig -e ‘s/bgcolor=#ffffff/bgcolor=#000000/i’ *.html
The above replaces the color white with black in all html files in this directory and saves the original files with .orig extension.
Use the script movein.sh from O’Reilley.
#!/bin/sh if [ -z "$1" ]; then echo "Usage: `basename $0` hostname" exit fi cd ~/.skel tar zhcf - . | ssh $1 "tar zpvxf -"
Read link for more info...
Need OpenSSL for this -
openssl genrsa 512/1024 http://www.mysite.com.key
openssl req -new -key http://www.mysite.com.key > http://www.mysite.com.csr
Enter country, state, locality, org name, org unit, comon name, and email when asked. Note: Common Name is http://www.mysite.com.
openssl -req -x509 -key http://www.mysite.com.key -in http://www.mysite.com.csr http://www.mysite.com.crt
X over ssh: ssh -X hostname
Forward port over ssh:
ssh -f -N -L110:mailhost:110 -l user mailhost
To find out what type of machine a host is, type:
nmap -O host
Compare services on your server or subnet, run this at 2 different times and then diff the files -
nmap -sX 10.14.34.0/24 | egrep -v '^(Nmap|Starting)' > nmap.out.date
Instead of constantly typing ‘ps -ef|grep yada’ over and over, use watch to highlight differences and tell you when the command finishes.
watch 'ps -ef|grep tar'
#Lock acct
passwd -l user
#Move directory to avoid .ssh, .rhosts, etc
mv /home/user /home/user.removed
#Check for running jobs
ps awux | grep -i ^user
skill -KILL user
#Check for cron jobs
crontab -u user -e
#remove user from sudo users file if needed
If you want to find out the process IDs for all process names containing ‘httpd’ -
pgrep httpd
321
324
455
If you want to kill all httpd processes -
pkill httpd
Find running kernel version:
cat /proc/version
How much RAM is installed:
ls -l /proc/kcore
Take file size and divide by 1024*1024
sudo users file format is as follows:
user machine=(effective user) commands
Aliases in any part are allowed and reference via all CAPS; UNIX group names are started with %.
User_Alias ADMINS=rob,jim,joep
root ALL=(ALL) ALL
joep elvis=(www) /bin/safe_mysqld,/usr/bin/top
ADMINS ALL=(bind) ALL
%staff ALL=(guest) ALL
In the ext2/ext3 filesystems sometimes you can’t remove a file even if you are root! This means the immutable flag is set. You can check it with the lsattr command. You can change it (or set it) with ‘chmod -i file‘.