LINUX 101

Sharing is caring

Views: 8

Linux File System

PathDescription
/The top-level directory is the root filesystem and contains all of the files required to boot the operating system before other filesystems are mounted as well as the files required to boot the other filesystems. After boot, all of the other filesystems are mounted at standard mount points as subdirectories of the root.
/binContains essential command binaries.
/bootConsists of the static bootloader, kernel executable, and files required to boot the Linux OS.
/devContains device files to facilitate access to every hardware device attached to the system.
/etcLocal system configuration files. Configuration files for installed applications may be saved here as well.
/homeEach user on the system has a subdirectory here for storage.
/libShared library files that are required for system boot.
/mediaExternal removable media devices such as USB drives are mounted here.
/mntTemporary mount point for regular filesystems.
/optOptional files such as third-party tools can be saved here.
/rootThe home directory for the root user.
/sbinThis directory contains executables used for system administration (binary system files).
/tmpThe operating system and many programs use this directory to store temporary files. This directory is generally cleared upon system boot and may be deleted at other times without any warning.
/usrContains executables, libraries, man files, etc.
/varThis directory contains variable data files such as log files, email in-boxes, web application related files, cron files, and more.

Unzip

gzip -d file.gz
tar -xf archive.tar.gz

Linux Cheat Sheet

CommandDescription
 man <tool>Opens man pages for the specified tool.
<tool> -hPrints the help page of the tool.
apropos <keyword>Searches through man pages’ descriptions for instances of a given keyword.
catConcatenate and print files.
whoamiDisplays current username.
idReturns users identity.
hostnameSets or prints the name of the current host system.
unamePrints operating system name.
pwdReturns working directory name.
ifconfigThe ifconfig utility is used to assign or view an address to a network interface and/or configure network interface parameters.
ipIp is a utility to show or manipulate routing, network devices, interfaces, and tunnels.
netstatShows network status.
ssAnother utility to investigate sockets.
psShows process status.
whoDisplays who is logged in.
envPrints environment or sets and executes a command.
lsblkLists block devices.
lsusbLists USB devices.
lsofLists opened files.
lspciLists PCI devices.
sudoExecute command as a different user.
suThe su utility requests appropriate user credentials via PAM and switches to that user ID (the default user is the superuser). A shell is then executed.
useraddCreates a new user or update default new user information.
userdelDeletes a user account and related files.
usermodModifies a user account.
addgroupAdds a group to the system.
delgroupRemoves a group from the system.
passwdChanges user password.
dpkgInstall, remove and configure Debian-based packages.
aptHigh-level package management command-line utility.
aptitudeAlternative to apt.
snapInstall, remove and configure snap packages.
gemStandard package manager for Ruby.
pipStandard package manager for Python.
gitRevision control system command-line utility.
systemctlCommand-line based service and systemd control manager.
psPrints a snapshot of the current processes.
journalctlQuery the systemd journal.
killSends a signal to a process.
bgPuts a process into background.
jobsLists all processes that are running in the background.
fgPuts a process into the foreground.
curlCommand-line utility to transfer data from or to a server.
wgetAn alternative to curl that downloads files from FTP or HTTP(s) server.
python3 -m http.serverStarts a Python3 web server on TCP port 8000.
lsLists directory contents.
cdChanges the directory.
clearClears the terminal.
touchCreates an empty file.
mkdirCreates a directory.
treeLists the contents of a directory recursively.
mvMove or rename files or directories.
cpCopy files or directories.
nanoTerminal based text editor.
whichReturns the path to a file or link.
findSearches for files in a directory hierarchy.
updatedbUpdates the locale database for existing contents on the system.
locateUses the locale database to find contents on the system.
morePager that is used to read STDOUT or files.
lessAn alternative to more with more features.
headPrints the first ten lines of STDOUT or a file.
tailPrints the last ten lines of STDOUT or a file.
sortSorts the contents of STDOUT or a file.
grepSearches for specific results that contain given patterns.
cutRemoves sections from each line of files.
trReplaces certain characters.
columnCommand-line based utility that formats its input into multiple columns.
awkPattern scanning and processing language.
sedA stream editor for filtering and transforming text.
wcPrints newline, word, and byte counts for a given input.
chmodChanges permission of a file or directory.
chownChanges the owner and group of a file or directory.