Useful Linux Commands
Another post in English, just like the Nintendo DS How-To. I think the following commands will be a usefull reference for future use and maybe a «cheat-sheet». I list them in categories for easier access. If you have any suggestions, questions, want to correct something or want to add a command, feel free to comment below.
ethtool eth0Shows status of ethernet interface eth0.
iwconfig eth1Shows status of the wireless interface eth1.
iwlist scanLists all wireless networks in range.
ip route showLists routing table.
netstat -tuplLists internet services on a system.
netstat -tupLists active connections to/from a system.
hostname -iShows localhost IP.
Windows Networking Commands (Samba):
smbtreeLists all Windows machines in a network. (See also findsmb)
smbclient-L windows_box Lists shares on windows machine or samba server.
mount -t smbfs -o fmask=666,guest //windows_box/share /mnt/shareMount a windows share.
nmblookup -A 188.8.131.52Finds the Windows (netbios) name associated with IP address.
Secure Shell (SSH):
ssh $USER@$HOST commandRuns command on $HOST as $USER.
ssh -g -L 8080:localhost:80 root@$HOSTForwards connections to $HOSTNAME:8080 out to $HOST:80.
ssh -R 1434:imap:143 root@$HOSTForwards connections from $HOST:1434 in to imap:143.
Archives and Compression:
gpg -c fileEncrypts a file.
gpg file.gpgDecrypts a file.
gzip < /dev/cdrom > cdrom.iso.gzSaves a copy of a data cd-rom.
mkisofs -V LABEL -r dir | gzip > cdrom.iso.gzCreates cd-rom image from contents of a dir.
mount -o loop cdrom.iso /mnt/dirMounts the cdrom image at /mnt/dir (read only).
cdparanoia -BRips audio tracks from CD to wav files in current dir.
oggenc --tracknum='track' track.cdda.wav -o 'track.ogg'Makes ogg file from wav file.
fdisk -lShows disks partitions sizes and types (run as root -> sudo fdisk -l).
df -hShows free space on mounted filesystems.
tcpdump not port 22Shows network traffic except SSH.
last rebootShows system reboot history.
free -mShows amount of (remaining) RAM (-m displays in MB).
uname -aShows kernel version and system architecture.
head -n1 /etc/issueShows name and version of distribution.
cat /proc/partitionsShows all partitions registered on the system.
grep MemTotal /proc/meminfoShows RAM total seen by the system.
grep "model name" /proc/cpuinfoShows CPU(s) info.
mount | column -tLists mounted filesystems on the system (and align output).
hdparm -i /dev/sdaShows info about disk sda.
Entry filed under: Tips, Tweaks and more, Ubuntu. Tags: console commands, disk usage commands, linux, linux commands, monitoring commands, mount commands, networking commands, samba protocol, SSH commands, system information commands, tar gz, unix, unix commands.