Linux useful commands

Here are a few linux commands that you may find useful:

SYSTEM

Find the kernel version:
cat /proc/version

Another way to get version
uname -a

Send an email from the command line:
echo “my test” | mail -s “test message” youremail@server.com

list hardware
lshw

#list network adapter
lshw -C network

FILESYSTEM
Create a whole directory tree in one shot:
mkdir -p /dir1/dir2/dir3..

List all partitions:
fdisk -l

Mount an .iso image:
mkdir /mnt/mycdimage
mount -o loop whatever-i386-disc1.iso /mnt/mycdimage

Show free disk space:
df -h

Show directory usage:
du -h

Count files in folder:
ls -1 | wc -l

Check for bad sectors:
badblocks -sv /dev/hda

Benchmark hard disk
hdparm -tT /dev/sda

Find files on disk
find /data1/partage/ -iregex .*php.*\.pdf       (will search for a regular expression at the directory specified )


Networking

Monitor networking traffic for the current network adapters
bwm-ng