< to add contents from here:>

Command library reference:

There are multiple Linux distributions (OS) such as Ubuntu and CentOS.

There are two interfaces to use Linux

GRUB (GRand Unified Bootloader) first loads during boot that replaces the BIOS when triggered (by Esc or Shift). It is a menu to select an installed Linux OS (if more than one installed) or an installed kernel.


Linux sections memory (RAM) to page divisions and configures spaces on the hard disk called swap space (space as file/partition). Swapping is where a page is virtually moved to a swap space.

As partitions are generally difficult to resize, creating it on an LVM makes it much more volatile.

Linux Flavor/Distro

.bashrc is located at the Home directory (i.e. /Home/<profilename>) which runs when the user logs in. The file contains configurations.

  • To add directory to variable: FILE_NAME=”/dirname”
  • To see directory from set variable: echo FILE_NAME

RedHat Linux

Package Management Tool: yum

RHEL (Red Hat Linux)

First RedHat open-source Linux distribution that has been replaced by other derivatives since 2004 due to being discontinued.


to view repo list: yum repolist

to install packages (packages to install are in repository): yum install <packagename>

To add user (add when in root): adduser <username>

To install/enable the PowerTools repository:

  • sudo dnf -y install
    • sudo dnf config-manager –set-enabled PowerTools
    • # if above fails, try the below
    • sudo dnf config-manager –set-enabled powertools
Package List
Package TypePackage NameUse
web browserlynxlynx <URL>


Package Management Tool: apt-get



Hold the Shift button when booting to access the kernel GRUB menu.

Check currently active kernel version: $ uname -mrs

To list available kernel versions to get for use: $ apt-cache search linux-generic

To install kernel, choose one from list and run one of the 2 below (e.g. linux-image-4.15.0-187-generic kernel)

  • $ sudo apt install linux-image-4.15.0-187-generic
  • $ sudo apt-get install linux-image-4.15.0-187-generic

To check if Secure Boot is enabled: sudo mokutil –sb-state

Using Linux Bash CLI

Command Line Cheat Sheet

use man <command> to find out about a command in detail

To run a shell script (*.sh): ./ (as root user, use sudo (Super User DO): sudo

. or ./Current working directory
~Home directory (e.g. ~/ for /home/USER)
.filenameThe ‘.’ signifies ‘filename’ is a hidden file
pwdPresent working directory
cd ..
cd /
Change directory
Move one directory up
Move to root
ls -R
ls -a
ls -al
List directory contents
List contents of directory and its subcontents
List directory contents including hidden
List directory contents including hidden with details
List block devices (e.g. hard disks)
cat > filename
cat filename1 filename2>filename3
List contents of file (e.g. cat note.txt)
Creates new file
Merges filename1 & filename2 to filename3
Copies(cp)/Moves(mv) file to a chosen directory
e.g. cp abc.txt /home/<username>/Desktop
copies abc.txt to Desktop (moves if mv over cp)
findFind directory/files
find . -name
find /opt -name abc.txt

To find filename starting with ‘do’ (use -iname argument for case insensitive):
find . -name do\*
Text editors
Find out about machine and OS
untarExtract contents of a tar.gz file
tar -xvf tarfilename.tar.gz
tar -xvf tarfilename.tar.gz -C /<dir>
lnSymbolic link (command creates link; any one changes the other)
ln -s <dir/filename> <NEW dir/filename>
Command Prompt Dissection
rootThe home directory of root , the system administrator
home Home directories of regular users
binShells and command-line utilities, some of which are required to run the system
sbinCommand-line system administration utilities, several of which are required to run the
libReusable system libraries needed by programs
usrPrograms, configuration settings, libraries, and help files that can be shared with
multiple systems
usr/binMany utilities and applications
usr/sbinMany system administration utilities
usr/libMany reusable system libraries that are used and dependent on by programs
varVariable data such as logs, database, web files, spool directories for mail, and so on
bootThe kernel, initial RAM disk, and boot loader, which are responsible for booting up the
etcSystem-wide configuration files
lost+foundFiles recovered by the file system checker after improper shutdowns such as a system
crash or power failure
mediaDirectories used for automatically mounting removable drives such as CD-ROM, DVD,
and USB storage devices
miscDirectories typically used for mounting NFS directories
srvData served by your system through services such as web, ftp, or cvs
mntFolders used for temporarily mounting remote directories (NFS, SMB) and removable drives(CD-ROM, DVD, and USB devices)
optthird-party software applications
procA virtual filesystem that contains special files used for changing or displaying kernel
devFiles that represent the hardware devices in your system and virtual devices supplied by
the kernel
selinuxA virtual filesystem containing special files used for changing or displaying SELinux
sysA virtual filesystem that contains special files used for changing or displaying devices
that are hot-pluggable
tmpTemporary files and folders that are deleted periodically by the system
Subdirectories in the Root Directory

Command List

whoamicurrent working user
su – rootswitch user to admin/root
pwdDisplays the present working directory.
cd <directory>
Changes the working directory.
mkdir <directory>
Creates a new directory.
mv <source> <target>
Renames or moves files or directories
ls <directory>
ls -a <dir>
Lists the contents of a directory
root directory contents: ls /
The -a shows all hidden files and folders
rm <file> [<file2>[<file..>]]
Deletes files.
rmdir <directory>
Deletes an empty directory.
shutdown -h now
shutdown -h +5
shutdown -h +5 “See you!”
-h halts all CPU functions
+5 is to shutdown CPU in 5 minutes
For more information: man <command name>


/root directory

ls -l /

Files such as text, image, database, binary, and so on
d (directory)A special file that can contain other files
(symbolic link)
A shortcut or reference to another file
(block device)
Devices that can send and receive buffered or random data such as CD, DVD, and hard disks
(char. device)
Devices that can send and receive data in a sequence of characters, such as modems and virtual terminals
Files used for communication within processes in the local system without using network protocols
(named pipe)
Pipes represented in the filesystem

vi <filename.txt>

press ‘i’ to enter text; press escape button, then immediately type ‘:q’ (‘:q!’ to quit without saving) then press ‘Enter’ to save and quit

to view contents of a file: cat <filename>


Launch applications . . .

  1. Press Activites @ top left >
    • OR
  2. Press Win/Command button on keyboard > select app and press Enter key

Switch tasks: Win/Command key + Tab


  1. Sicam, C., Baclit, R., Membrey, P., & Newbigin, J. (2009). Foundations of CentOS Linux Enterprise Linux On the Cheap. Berkeley, CA: Apress.
  2. Dave_Child. “Linux Command Line Cheat Sheet.” Cheatography, Cheatography Https://, 28 Oct. 2011,
  3. “35 Linux Basic Commands Every User Should Know (Cheat Sheet).” Hostinger Tutorials, 13 May 2021,

--- :: Skyferia Tech's Related Posts :: ---