Facebooktwitterredditpinterestlinkedintumblr

If you use Linux, you know that Linux commands can be your strength or your downfall. Linux commands are even more vital if you are a Linux Systems Administrator. Without them, you won’t be able to manage Linux systems. It’s either you know it or you don’t.

With that said, how can we help? How would you like to have a list of very, useful Linux commands at your disposal?

Well, you’re in luck. The Linux commands below are available for you on an easy-to-use page. There is no charge. It is free to use and available anytime you need it. Feel free to come back to this article again and again as a reference for your Linux needs. Enjoy!

The tables below are broken up into different categories for readability. In the table, the column lists the command that should be run on the terminal console of your Linux machine. The second column describes what the command does. The third column describes whether root is required. If root is required, then sudo must accompany the command.

For example, run the command below to show the hardware system components.

sudo dmidecode -q

Here are some basic commands that will get you started on learning more about your Linux operating system.

System Information

Command to runDescriptionRequires root?
uname -rshow used kernel versionNo
dmidecode -qshow hardware system components (SMBIOS / DMI)Yes
cat /proc/cpuinfoshow CPU informationNo
cat /proc/interruptsshow interruptsNo
cat /proc/meminfoshow memory informationNo
cat /proc/swapsshow file swapNo
cat /proc/versionshow version of the kernelNo
cat /proc/net/devshow network adapters statisticsNo
cat /proc/mountsshow mounted file systemsNo
lspci -tvshow PCI devicesNo
lshwshow detailed hardware informationYes
dateshow system dateNo
cal 2008show the calendar for 2008No

Important commands to know when you need to reboot or shut down.

Shutdown or Restart a System

Command to runDescriptionRequires root?
shutdown -h nowpower off the system right nowYes
shutdown -r nowrestart the system right nowYes
rebootrestart the system right nowYes

Learn more about your file system with these commands.

Attaching to a File System

Command to runDescriptionRequires root?
mkdir /mnt/floppy
mount /dev/fd0 /mnt/floppy
attach to a floppy driveYes
umount /mnt/floppyunattached the floppy driveYes
mount /dev/cdrom /mnt/cdromattach to a CD or DVD driveYes
mkdir /mnt/MyFiles
mount -t smbfs -o username=myuser,password=mypass //MyComputer/MyFiles /mnt/MyFiles
attach to a Windows network share called MyFiles using the provided Windows credentialsYes

Compressing and decompressing files should be part of your arsenal when working with files.

Archives and Compressed Files

Command to runDescriptionRequires root?
tar cvfz myfile1.tar.gzcreate an archive zipped file called myfile1.tar.gzNo
tar -tf myfile1.tarshow the contents of an archive file called myfile1.tarNo
tar cvf myfile1.tar file1 file2 dir1create an archive file containing file1, file2, and directory1No
gunzip myfile1.gzuncompress a fileNo
unzip myfile1.zipuncompress a fileNo
tar -xvf myfile1.taruncompress the archive file called myfile1.tarNo
tar zxvf myfile1.tar.gzuncompress an archive and zipped file called myfile1.tar.gzNo

These commands for CDROM come in handy.

CDROM

Command to runDescriptionRequires root?
mkisofs /dev/cdrom > mycd.isocreate an ISO image from a CD-ROMNo
cdrecord -v dev=/dev/cdrom mycd.isorecord data from ISO image mycd.iso to a CD-ROMNo
mkdir /mnt/iso
mount -o loop -t iso9660 <filename of ISO image> /mnt/iso
View contents of an ISO image from your hard driveYes

Networking with interfaces, rather than people, are also important trades to learn.

Networking

Command to runDescriptionRequires root?
ifconfigshow configuration of all network interfacesNo
route -nshow routing tableNo
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1add a static route to reach network 192.168.0.0/16 via the gateway 192.168.1.1No
host www.somehost.comresolve the hostname to IP addressNo
netstat -tupshow all active network connections and their PIDNo
netstat -tuplshow all network services listening on the system and their PIDNo
iwlist scanshow wireless networksNo
iwconfigshow configuration of all wireless network interfacesNo

What packages do you have installed? Learn to install and remove them.

DEB Packages (Debian, Ubuntu)

Command to runDescriptionRequires root?
dpkg -i package_name.debinstall or upgrade a Debian packageYes
dpkg -r package_nameremove a Debian package from the systemYes
dpkg -lshow all Debian packages installed on the systemNo
dpkg -s package_nameshow information about a specific package installed on the systemNo
dpkg -L package_nameshow list of files provided by a package installed on the systemNo

Files need to be manipulated. These commands will show you how.

Text Manipulation

Command to runDescriptionRequires root?
cat -n file1displays the content of the text file and numbering each rowNo
tac file1displays the content of the text file in reverse orderNo
tail file1displays the last 10 lines of a fileNo
grep “Feb 9” /var/log/messagesdisplays each line in the file that contains the words “Feb 9”No
cat file1 | tr a-z A-Zshows the content of file in upper case letters
Tim Miller

Tim has always been obsessed with computers his whole life. After working for 25 years in the computer and electronics field, he now enjoys writing about computers to help others. Most of his time is spent in front of his computer or other technology to continue to learn more. He likes to try new things and keep up with the latest industry trends so he can share them with others.

Leave a Comment