Unix gems

A page of Unix gems which I occasionally find useful:

List hosts on Network:
nmap -sP

list ports used:

netstat -na

lsof -i
sudo lsof -i :port

Copy lots of files between hosts:
rsync -r -v --progress -e ssh /home/user/ user@remote-system:/address/to/remote/file

crontab -e
- Opens an editor with the current crontab-file
crontab -l
- List the content of the current crontab-file
crontab -r
- Remove the current crontab-file
crontab FILENAME
- Set the current crontab-file to FILENAME

Symbolic links:
ln -sf filename symbolicname

Create a 2Mb file with random junk:
dd if=/dev/urandom of=~/foo.txt bs=1M count=2

Using tar to compress files:
tar -zcf filenavn.tar.gz *
tar -zxvf filenavn.tar.gz

Recursive grep'ping:
grep -R "server.configuration.dir" --include '*.xml' *

Ingen kommentarer:

Send en kommentar