Commonly Used Red Hat Linux Commands

Designed for seasoned Red Hat professionals, this page serves as a quick reference for commands that aren’t used daily but remain critical for effective system administration. Each command listed here has been carefully selected for its relevance in real-world scenarios, from troubleshooting and security management to system performance tuning. We recommend reviewing the entire list regularly and practicing each command in a test environment to reinforce your knowledge and ensure you can confidently apply it when needed. Consistent review and hands-on practice will help maintain your command-line proficiency and readiness for any task.

File System Navigation

CommandFunctionality
ls -lhZLong List (l) of directory contents to include human-readable (h) file sizes and SELinux (Z) contexts.
cd ../../new-path/Change Directory going back two directories and forward into new-path
pwdLists Present Working Directory
du -hDisplays estimate file space usage

File Manipulation

CommandFunctionality
echo “Test” > file.txtEchoes the word “Test” into file.txt. If file existed prior, it is completely remade.
echo “Test” >> file.txtAppends file.txt with the word “Test”.
vi test.txt
vim test.txt
Opens test.txt in a text editor.
zip -r directory.zip directory/Creates a zip file of a directory.
unzip directory.zipUnzips a compressed zip file.
tar -cvzf directory.tar.giz /path/to/directoryCreates a compressed tar gunzip file from directory contents.
tar -xvzf directory.tar.gzExtracts contents of compressed tar gunzip file.
rm file.txtRemoves file.txt file.
rmdir directory/Removes empty directory.
touch example.txtCreates an empty file named example.txt.

Reviewing Physical System Components

CommandFunctionality
lsblkLists block devices (hard drives)
lspciLists PCI devices
lsmodLists Kernel Modules
df -hDisplays file systems and their disk space usage
cat /proc/meminfoHolds information about system memory
cat /proc/cpuinfoHolds information about system processor(s)
dmidecodeDMI Table decoder dumps computer’s DMI/SMBIOS information.
mount IP:/mount/point /mntMounts a remotely-defined path to /mnt
mount /homeMounts /home by referencing contents of the /etc/fstab
umount -l /homeLazily (forced) unmount of the /home directory.

Processes and Log Review

CommandFunctionality
tail -f /var/log/messagesTails messages log and follows all new output.
journalctlSystemd Journal
systemctl status/start/stop/restart/enable/disable daemonCommonly used systemctl commands to manage service daemons.
dmesgLists the kernel ring buffer
/var/log
/var/log/messages
/var/log/secure
/var/log/audit/audit.log
Commonly used system logs
topDisplays top processes actively running.
ps -efLists every process on the system
vmstatVirtual memory utilization
kill -9 <pid>Kills a process, referencing its process identifier, from running

File System Permissions

ll /path/to/folderLong list of folder contents with permissions.
chown <username> file.txtChanges owner of file.txt to specified username.
chgrp <group> file.txtChanges group of file.txt to specified group.
chmod 750 file.txtChanges mode bits of file.txt to provide full access to owner, read-execute to group, and none to other.
Bits:
1 Execute
2 – Read
4 – Write
chmod g+s /path/to/folderAll new files and folders inherit the current group instead of the user’s default group. SetGid is shown in a long list as an s.
getfacl /path/to/folderGets file access control lists
setfacl -d -m g:<group>:rx /path/folderSets file access control list default on folder to allow defined group read-execute privileges for all new content. No recursion.
setfacl -Rm u:<user>:rwx /path/folderSets file access control list recursively on folder to allow defined user read/write/execute privileges for current content.
setfacl -b /path/folderRemoves all file access control lists on folder

Networking

CommandFunctionality
nmtuiNetwork Manager Text User Interface for controlling NetworkManager
nmcliNetwork Manager Command-line Interface for controlling NetworkManager
ip addressDisplays IP, routing, network devices, interfaces, and tunnels.
systemctl restart NetworkManagerRestarts NetworkManager system daemon.

Back to Course

Next