Misc Linux notes

Find help

Show all man pages containing the keyword:

apropos keyword

List files in a zip archive

unzip -l the.zip

Copy with parents

To copy loc, creating /the/file directories beneath it at the destination:

cp --parents /the/file/loc /to/wherever/.

Images

To find out info about an image from the command line:

identify [image]

The command comes from the imagemagick package.

EOT

EOT stands for End Of Text. You can send an EOT via ctrl-d.

List fonts

fc-list
chown -h user:group symlink

Without the -h switch it will change the ownership of the symlink target.

Forward email from user to email address

Create a hidden file called .forward in the user’s home directory that contains the email address you’d like to forward mails to.

Send test email

echo "This will go into the body of the mail." | mail -s "This is the subject of the email" you@example.com

See which processes are using a port

As root…

netstat -anp

-a for all ports -n for port numbers (instead of service names looked up in /etc/services) -p for processes

See which ports are open

nmap [domain|IP]

Nmap will show ports as open, filtered, or closed. If filtered, it means nmap doesn’t know the port’s state because some network obstacle is in the way).

MD5 checksums

Compute the MD5 sum and store it in a file using:

md5sum file > file.md5

Check for validity with:

md5sum -c file.md5

Virus scan

Scan root (writing log to clamscan.log):

clamscan -r-lclamscan.log /

List infected files:

grep FOUND clamscan.log | sed 's/ /\\ /g' | sed 's/:\\ [^:]* FOUND//g' | xargs ls -l

Last modified: 16/10/2011 Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top