NEW
Font size
WorksheetsLinux Commands Quiz
Total questions: 60
Worksheet time: 30mins
The man command is used to access the detailed user manual for any other command. It provides comprehensive information about the command's syntax, options, and usage examples. For instance, man ls shows everything about the ls command.
Displays the manual (documentation) for other commands.
Lists the contents of a directory (files and folders).
Changes the current working directory.
Prints the full path of the current/working directory.
The ls command lists files and directories. The -l option provides a detailed list with permissions, owner, size, and modification time. The -a option includes hidden files (those starting with a dot). Combining them as ls -al is very common.
Displays the manual (documentation) for other commands.
Lists the contents of a directory (files and folders).
Changes the current working directory.
Prints the full path of the current/working directory.
The cd command is used to navigate between directories. cd folder moves into 'folder', cd .. moves up to the parent directory, and cd or cd ~ takes you directly to your home directory from anywhere.
Changes the current working directory.
Lists the contents of a directory (files and folders).
Prints the full path of the current/working directory.
Creates new directories.
The pwd command outputs the absolute path of the directory you are currently working in. This is essential for orientation within the complex Linux filesystem hierarchy.
Changes the current working directory.
Lists the contents of a directory (files and folders).
Prints the full path of the current/working directory.
Creates new directories.
The mkdir command creates new directories. The powerful -p option allows you to create an entire path of nested directories at once, even if the parent directories don't already exist.
Creates new directories.
Removes empty directories.
Moves or renames files and directories.
Copies files and directories.
The rmdir command is used to delete empty directories. It is a safe command as it will not delete a directory that contains any files or subdirectories, preventing accidental data loss.
Creates new directories.
Removes empty directories.
Moves or renames files and directories.
Copies files and directories.
The mv command has a dual purpose. It is used to move files/directories from one location to another. It is also used to rename them, as renaming is essentially moving the file to the same location with a new name.
Moves or renames files and directories.
Creates new directories.
Removes empty directories.
Copies files and directories.
The cp command creates a copy of a file. To copy an entire directory, including all its subdirectories and files, the -r (recursive) option must be used, as in cp -r dir1 dir2.
Copies files and directories.
Moves or renames files and directories.
Creates new directories.
Removes empty directories.
(Primarily for macOS) The open command is used to open a file with its default GUI application or to open a directory in the Finder. For example, open . opens the current folder.
Opens a file or directory using the default application.
Creates new directories.
Removes empty directories.
Copies files and directories.
The touch command's primary function is to update the access and modification timestamps of a file to the current time. A side effect is that if the file does not exist, touch will create a new, empty file with that name.
Creates an empty new file or updates the timestamp of an existing file.
Opens a file or directory using the default application.
Removes empty directories.
Copies files and directories.
The find command is a powerful utility for searching the filesystem. It can locate files by name (-name), type (-type f for files), modification time (-mtime), and size. It can also execute commands on the results using -exec.
Recursively searches for files and directories based on various criteria.
Creates new directories.
Removes empty directories.
Copies files and directories.
The ln command creates links. A hard link (ln file link) is a direct reference to the file's data. A soft link (ln -s file link) is a separate file that points to the original's path. Soft links are more flexible but break if the original is moved.
Creates links (shortcuts) between files.
Removes empty directories.
Copies files and directories.
Moves or renames files and directories.
The gzip command compresses a file, replacing it with a compressed version ending in .gz. Use the -k option to keep the original file. The -d option is used to decompress a .gz file.
Compresses files using the LZ77 algorithm.
Removes empty directories.
Creates new directories.
Copies files and directories.
The gunzip command is specifically used to decompress files that have been compressed with gzip. It is functionally identical to running gzip -d.
Decompresses files compressed by gzip.
Creates new directories.
Removes empty directories.
Copies files and directories.
The tar command bundles multiple files into a single archive file. The -cf options create an archive, and -xf extract it. Adding the -z option (e.g., -czf) compresses the archive using gzip, creating a .tar.gz file.
Archives multiple files into a single file.
Creates new directories.
Removes empty directories.
Copies files and directories.
The alias command lets you create a custom shorthand for a longer command. For example, alias ll='ls -al' allows you to type ll to get a detailed file listing. They are temporary unless saved in a shell startup file.
Creates a shortcut or nickname for a longer command.
Removes empty directories.
Copies files and directories.
Moves or renames files and directories.
The cat command is primarily used to display the contents of a file on the screen. It can also be used to combine the contents of multiple files and redirect the output to a new file using >.
Concatenates and prints the contents of files to the standard output.
Creates new directories.
Removes empty directories.
Copies files and directories.
The less command opens a file for interactive viewing. It allows you to scroll up and down through large files easily, search for text with /, and jump to the beginning (g) or end (G). It is more efficient than cat for large files.
Views file contents interactively, one screen at a time.
Creates new directories.
Removes empty directories.
Copies files and directories.
The tail command displays the last few lines of a file by default (usually 10). The -n option specifies how many lines to show, and the -f option is vital for monitoring log files in real-time as new entries are added.
Outputs the last part of a file.
Creates new directories.
Removes empty directories.
Copies files and directories.
The wc (word count) command prints the number of lines, words, and bytes contained in a file. Common options include -l to count only lines and -w to count only words. It is often used with pipes, e.g., ls | wc -l.
Counts lines, words, and bytes in a file or input.
Creates new directories.
Removes empty directories.
Copies files and directories.
The grep command searches for patterns (text/regular expressions) within files or input.
Searches for patterns within files or input.
Creates new directories.
Removes empty directories.
Copies files and directories.
What does the grep command do?
Searches for patterns within files or input
Sorts lines of text in a file
Filters out adjacent duplicate lines
Compares two files line by line
What does the sort command do?
Searches for patterns within files or input
Sorts lines of text in a file
Filters out adjacent duplicate lines
Compares two files line by line
What does the uniq command do?
Searches for patterns within files or input
Sorts lines of text in a file
Filters out adjacent duplicate lines
Compares two files line by line
What does the diff command do?
Searches for patterns within files or input
Sorts lines of text in a file
Filters out adjacent duplicate lines
Compares two files line by line
What does the echo command do?
Prints text or variables to the terminal
Changes the user and/or group ownership of a file
Changes the permissions of a file or directory
Sets the default permissions for newly created files
What does the chown command do?
Prints text or variables to the terminal
Changes the user and/or group ownership of a file
Changes the permissions of a file or directory
Sets the default permissions for newly created files
What does the chmod command do?
Prints text or variables to the terminal
Changes the user and/or group ownership of a file
Changes the permissions of a file or directory
Sets the default permissions for newly created files
What does the umask command do?
Prints text or variables to the terminal
Changes the user and/or group ownership of a file
Changes the permissions of a file or directory
Sets the default permissions for newly created files
What does the du command do?
Estimates file and directory space usage
Reports disk space usage for mounted filesystems
Strips directory and trailing suffixes from a file path
Strips the last component from a file path
What does the df command do?
Estimates file and directory space usage
Reports disk space usage for mounted filesystems
Strips directory and trailing suffixes from a file path
Strips the last component from a file path
What does the basename command do?
Strips directory and trailing suffixes from a file path
Strips the last component from a file path
Provides a snapshot of currently running processes
Provides a dynamic view of running processes
What does the dirname command do?
Strips directory and trailing suffixes from a file path
Strips the last component from a file path
Provides a snapshot of currently running processes
Provides a dynamic view of running processes
What does the ps command do?
Provides a snapshot of currently running processes
Provides a dynamic view of running processes
Sends a signal to a process
Kills processes by name
What does the top command do?
Provides a snapshot of currently running processes
Provides a dynamic view of running processes
Sends a signal to a process
Kills processes by name
What does the kill command do?
Sends a signal to a process
Kills processes by name
Lists jobs that have been started in the current shell session
Resumes a suspended job in the background
What does the killall command do?
Sends a signal to a process
Kills processes by name
Lists jobs that have been started in the current shell session
Resumes a suspended job in the background
What does the jobs command do?
Lists jobs that have been started in the current shell session
Resumes a suspended job in the background
Brings a background or suspended job to the foreground
Indicates how a command name would be interpreted by the shell
What does the bg command do?
Lists jobs that have been started in the current shell session
Resumes a suspended job in the background
Brings a background or suspended job to the foreground
Indicates how a command name would be interpreted by the shell
What does the fg command do?
Lists jobs that have been started in the current shell session
Resumes a suspended job in the background
Brings a background or suspended job to the foreground
Indicates how a command name would be interpreted by the shell
What does the type command do?
Indicates how a command name would be interpreted by the shell
Lists jobs that have been started in the current shell session
Resumes a suspended job in the background
Brings a background or suspended job to the foreground
The type command explains how the shell will interpret a given command. It reveals if the command is an alias, a shell built-in, a function, or an external executable file located on disk, which is useful for debugging and understanding shell behavior.
True
False
Locates the executable file for a given command by searching the PATH environment variable.
which
whereis
find
locate
Runs a command immune to hangups, allowing it to continue running after the user logs out.
nohup
bg
fg
disown
Builds and executes command lines from standard input. It converts input into arguments for another command.
xargs
exec
apply
map
A highly configurable and powerful modal text editor.
vim
nano
emacs
gedit
A highly extensible and powerful text editor and application platform.
emacs
vim
nano
gedit
A simple, user-friendly command-line text editor.
nano
vim
emacs
gedit
Prints the effective username of the current user.
whoami
who
id
echo $USER
Shows who is logged on to the system.
who
users
w
last
Switches the current user to another user (Substitute User). Defaults to switching to the root user.
su
sudo
login
chown
Executes a command as another user, typically the superuser (root). It uses the current user's password.
sudo
su
runas
exec
Changes a user's password.
passwd
chpasswd
usermod
change
Tests network connectivity to another host on a network (local or Internet).
ping
traceroute
curl
wget
Shows the route (path) that packets take to reach a network host, listing all intermediate hops (routers).
traceroute
ping
route
netstat
Clears the terminal screen.
clear
cls
reset
wipe
Displays the command history list for the current shell session.
history
log
record
track
Sets environment variables. These variables are passed to child processes of the shell.
export
set
env
define
Edits, installs, deletes, or lists the user's cron jobs (scheduled tasks).
crontab
cron
at
schedule
Prints system information (kernel name, version, hardware, etc.).
uname
info
sysinfo
version
