Click on the above“Beginner Learning Visuals”, select to add “Star” or “Pin”
Heavyweight content delivered first-hand

System Information
arch # Show the machine's processor architecture (1)
uname -m # Show the machine's processor architecture (2)
uname -r # Show the currently used kernel version
dmidecode -q # Show hardware system components - (SMBIOS / DMI)
hdparm -i /dev/hda # List a disk's architectural features
hdparm -tT /dev/sda # Perform test read operations on the disk
cat /proc/cpuinfo # Show CPU info
cat /proc/interrupts # Show interrupts
cat /proc/meminfo # Check memory usage
cat /proc/swaps # Show which swap is being used
cat /proc/version # Show kernel version
cat /proc/net/dev # Show network adapters and statistics
cat /proc/mounts # Show loaded file systems
lspci -tv # List PCI devices
lsusb -tv # Show USB devices
Date Display System Date
cal 2007 # Display the calendar for the year 2007
date 041217002007.00 # Set date and time - month day hour minute year.second
clock -w # Modify and save time to BIOS
Shutdown (System Shutdown, Restart, and Logout)
shutdown -h now # Shut down the system (1)
init 0 # Shut down the system (2)
telinit 0 # Shut down the system (3)
shutdown -h hours:minutes & # Shut down the system at a scheduled time
shutdown -c # Cancel the scheduled shutdown
shutdown -r now # Restart (1)
reboot # Restart (2)
logout # Logout
Files and Directories
cd /home # Enter '/home' directory
cd .. # Go back to the previous directory
cd ../.. # Go back two directories
cd # Enter the user's home directory
cd ~user1 # Enter user1's home directory
cd - # Go back to the last directory
pwd # Show the working path
ls # View files in the directory
ls -F # View files in the directory
ls -l # Show detailed information of files and directories
ls -a # Show hidden files
ls *[0-9]* # Show filenames and directory names containing numbers
tree # Show the tree structure of files and directories starting from the root (1)
lstree # Show the tree structure of files and directories starting from the root (2)
mkdir dir1 # Create a directory called 'dir1'
mkdir dir1 dir2 # Create two directories at once
mkdir -p /tmp/dir1/dir2 # Create a directory tree
rm -f file1 # Delete a file called 'file1'
rmdir dir1 # Delete a directory called 'dir1'
rm -rf dir1 # Delete a directory called 'dir1' and its contents
rm -rf dir1 dir2 # Delete two directories and their contents at once
mv dir1 new_dir # Rename/move a directory
cp file1 file2 # Copy a file
cp dir/* . # Copy all files from a directory to the current working directory
cp -a /tmp/dir1 . # Copy a directory to the current working directory
cp -a dir1 dir2 # Copy a directory
ln -s file1 lnk1 # Create a symbolic link to a file or directory
ln file1 lnk1 # Create a hard link to a file or directory
touch -t 0712250000 file1 # Modify a file or directory's timestamp - (YYMMDDhhmm)
file file1 outputs the mime type of the file as text
iconv -l # List known encodings
iconv -f fromEncoding -t toEncoding inputFile > outputFile creates a new from the given input file by assuming it is encoded in fromEncoding and converting it to toEncoding.
find . -maxdepth 1 -name *.jpg -print -exec convert "{}" -resize 80x60 "thumbs/{}" \; batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick)
File Search
find / -name file1 # Start searching for files and directories from '/'
find / -user user1 # Search for files and directories belonging to user 'user1'
find /home/user1 -name \\*.bin # Search for files ending with '.bin' in '/home/user1' directory
find /usr/bin -type f -atime +100 # Search for executable files not used in the last 100 days
find /usr/bin -type f -mtime -10 # Search for files created or modified in the last 10 days
find / -name \\*.rpm -exec chmod 755 '{}' \; # Search for files ending with '.rpm' and set permissions
find / -xdev -name \\*.rpm # Search for files ending with '.rpm', ignoring removable devices like CD-ROMs and USB drives
locate \\*.ps # Find files ending with '.ps' - first run 'updatedb' command
whereis halt # Show the location of a binary file, source, or man page
which halt # Show the full path of a binary or executable file
Mounting a File System
mount /dev/hda2 /mnt/hda2 # Mount a disk called hda2 - ensure the directory '/mnt/hda2' exists
umount /dev/hda2 # Unmount a disk called hda2 - first exit from the mount point '/mnt/hda2'
fuser -km /mnt/hda2 # Force unmount when the device is busy
umount -n /mnt/hda2 # Run unmount operation without writing to /etc/mtab - very useful when the file is read-only or when the disk is full
mount /dev/fd0 /mnt/floppy # Mount a floppy disk
mount /dev/cdrom /mnt/cdrom # Mount a CD-ROM or DVD-ROM
mount /dev/hdc /mnt/cdrecorder # Mount a CD-RW or DVD-ROM
mount /dev/hdb /mnt/cdrecorder # Mount a CD-RW or DVD-ROM
mount -o loop file.iso /mnt/cdrom # Mount a file or ISO image file
mount -t vfat /dev/hda5 /mnt/hda5 # Mount a Windows FAT32 file system
mount /dev/sda1 /mnt/usbdisk # Mount a USB flash drive or device
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share # Mount a Windows network share
Disk Space
df -h # Show the list of mounted partitions
ls -lSr |more # Sort files and directories by size
du -sh dir1 # Estimate the disk space used by directory 'dir1'
du -sk * | sort -rn # Display file and directory sizes in descending order based on capacity
rpm -q -a --qf '%10{SIZE}t%{NAME}n' | sort -k1,1n
# Display installed rpm packages sorted by size (fedora, redhat systems)
dpkg-query -W -f='${Installed-Size;10}t${Package}n' | sort -k1,1n
# Display installed deb packages sorted by size (ubuntu, debian systems)
Users and Groups
groupadd group_name # Create a new user group
groupdel group_name # Delete a user group
groupmod -n new_group_name old_group_name # Rename a user group
useradd -c "Name Surname " -g admin -d /home/user1 -s /bin/bash user1 # Create a user belonging to the "admin" group
useradd user1 # Create a new user
userdel -r user1 # Delete a user ('-r' excludes home directory)
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1 # Modify user properties
passwd # Change password
passwd user1 # Change a user's password (only allowed for root)
chage -E 2005-12-31 user1 # Set user password expiration date
pwck # Check the format and syntax of '/etc/passwd' and existing users
grpck # Check the format and syntax of '/etc/passwd' and existing groups
newgrp group_name # Log into a new group to change the default group for newly created files
File Permissions
Use "+" to set permissions, use "-" to revoke
ls -lh # Display permissions
ls /tmp | pr -T5 -W$COLUMNS # Divide the terminal into 5 columns
chmod ugo+rwx directory1 # Set read (r), write (w), and execute (x) permissions for owner (u), group (g), and others (o) on the directory
chmod go-rwx directory1 # Remove read, write, and execute permissions for group (g) and others (o) on the directory
chown user1 file1 # Change the owner of a file
chown -R user1 directory1 # Change the owner of a directory and all files within it
chgrp group1 file1 # Change the group of a file
chown user1:group1 file1 # Change the owner and group of a file
find / -perm -u+s # List all files in the system with SUID control
chmod u+s /bin/file1 # Set the SUID bit on a binary file - the user running the file also gets the same permissions as the owner
chmod u-s /bin/file1 # Disable the SUID bit on a binary file
chmod g+s /home/public # Set the SGID bit on a directory - similar to SUID, but for directories
chmod g-s /home/public # Disable the SGID bit on a directory
chmod o+t /home/public # Set the STIKY bit on a file - only the legitimate owner can delete the file
chmod o-t /home/public # Disable the STIKY bit on a directory
File Special Attributes
- Use "+" to set permissions, use "-" to revoke
chattr +a file1 # Allow file to be read/written only in append mode
chattr +c file1 # Allow this file to be automatically compressed/decompressed by the kernel
chattr +d file1 # Ignore this file during filesystem backups by the dump program
chattr +i file1 # Set the file as immutable, cannot be deleted, modified, renamed, or linked
chattr +s file1 # Allow a file to be securely deleted
chattr +S file1 # Immediately write modified results to disk when an application writes to this file
chattr +u file1 # If the file is deleted, the system will allow you to recover this deleted file later
lsattr # Show special attributes
Packing and Compressing Files
bunzip2 file1.bz2 # Unzip a file called 'file1.bz2'
bzip2 file1 # Compress a file called 'file1'
gunzip file1.gz # Unzip a file called 'file1.gz'
gzip file1 # Compress a file called 'file1'
gzip -9 file1 # Maximum compression
rar a file1.rar test_file # Create a package called 'file1.rar'ar a file1.rar file1 file2 dir1 # Compress 'file1', 'file2', and directory 'dir1' at once
rar x file1.rar # Unzip rar package
unrar x file1.rar # Unzip rar package
tar -cvf archive.tar file1 # Create a non-compressed tarball
tar -cvf archive.tar file1 file2 dir1 # Create an archive file containing 'file1', 'file2', and 'dir1'
tar -tf archive.tar # Show contents of an archive
tar -xvf archive.tar # Extract an archive
tar -xvf archive.tar -C /tmp # Extract an archive to /tmp directory
tar -cvfj archive.tar.bz2 dir1 # Create a bzip2 formatted archive
tar -jxvf archive.tar.bz2 # Unzip a bzip2 formatted archive
tar -cvfz archive.tar.gz dir1 # Create a gzip formatted archive
tar -zxvf archive.tar.gz # Unzip a gzip formatted archive
zip file1.zip file1 # Create a zip formatted archive
zip -r file1.zip file1 file2 dir1 # Compress several files and directories into a zip formatted archive
unzip file1.zip # Unzip a zip formatted archive
RPM Package – (Fedora, Redhat and Similar Systems)
rpm -ivh package.rpm # Install an rpm package
rpm -ivh --nodeeps package.rpm # Install an rpm package ignoring dependency warnings
rpm -U package.rpm # Update an rpm package without changing its configuration files
rpm -F package.rpm # Update a confirmed installed rpm package
rpm -e package_name.rpm # Delete an rpm package
rpm -qa # Show all installed rpm packages in the system
rpm -qa | grep httpd # Show all rpm packages with