Linux Command Line Flashcards: Essential Commands, Flags & Workflows
Practice essential Linux terminal commands through 100 task-first cards on paths, files, search, pipes, permissions, processes, archives, and system checks.
Sobre aquesta baralla
Build reliable Linux command-line recall with 100 original, task-first flashcards. The sequence starts with help and navigation, then moves through files, text search, pipes and redirection, permissions, processes, archives, storage, remote access, and everyday Bash workflows.
The cards practice four useful mappings: a realistic task to a command shape; a command, flag, or shell operator to its effect; an output or exit-status cue to its meaning; and a close choice to the safer or more suitable tool. Related prompts are spaced apart so a nearby answer does not give away the next card.
This deck focuses on frequent Linux CLI decisions, not every option a command supports. It excludes Git, certification objectives, shell scripting as a subject, distro-specific package managers, destructive recursive examples, and advanced system administration.
The wording, examples, sequence, and cover are original. Facts were checked against POSIX, the GNU Coding Standards, GNU Coreutils, GNU Bash, GNU Grep, GNU Findutils, GNU tar, GNU gzip, GNU Diffutils, Linux manual pages, ncurses, OpenSSH, and curl documentation. Source links stay on the relevant cards. Third-party documentation, source titles, trademarks, and factual material remain subject to their own rights; the CC0 label applies only to the original deck material to the extent applicable rights exist.
Targetes d'aquesta baralla
Targeta 1
Pregunta
Open the manual page for a command.
Resposta
Use
man COMMAND, for exampleman ls. It opens the installed manual entry when one is available.Source: man-pages: man(1).
Targeta 2
Pregunta
Print the current working directory.
Resposta
Use
pwd. It prints the absolute path of the directory the shell is currently in.Source: GNU Coreutils:
pwd.Targeta 3
Pregunta
Create an empty file or update a file's timestamps.
Resposta
Use
touch FILE. It creates an empty file if the path does not exist; otherwise it updates the selected timestamps.Source: GNU Coreutils:
touch.Targeta 4
Pregunta
Print a small text file to standard output.
Resposta
Use
cat FILE. It copies the file's contents to standard output; use a pager such aslessfor long files.Source: GNU Coreutils:
cat.Targeta 5
Pregunta
Send one command's standard output into another command.
Resposta
Use a pipe:
COMMAND1 | COMMAND2. The shell connects the first command's standard output to the second command's standard input.Source: GNU Bash: pipelines.
Targeta 6
Pregunta
Where do you see a file's permission bits in
ls -loutput?Resposta
At the start of each entry, after the file-type character. A value such as
-rw-r--r--shows the type first, then user, group, and other permissions.Source: GNU Coreutils: long listing format.
Targeta 7
Pregunta
Take a quick snapshot of processes associated with the current terminal.
Resposta
Use
ps. With its default selection, it gives a one-time process listing rather than a live display.Source: procps-ng:
ps.Targeta 8
Pregunta
Create an uncompressed tar archive from files or directories.
Resposta
Use
tar -cf ARCHIVE.tar PATH....-ccreates an archive and-fnames the archive file.Source: GNU tar: create.
Targeta 9
Pregunta
Open an interactive shell on a remote machine over SSH.
Resposta
Use
ssh USER@HOST. SSH connects to the remote host and can start an authenticated login session.Source: OpenSSH:
ssh.Targeta 10
Pregunta
Display the current environment variables.
Resposta
Use
env. With no command or assignments, it prints the current environment.Source: GNU Coreutils:
env.Targeta 11
Pregunta
Ask a GNU command for its short built-in usage help.
Resposta
Try
COMMAND --help. GNU command-line programs conventionally use--helpfor a brief usage summary; not every non-GNU command follows this convention.Source: GNU coding standards:
--help.Targeta 12
Pregunta
List the current directory's visible entries.
Resposta
Use
ls. By default, names beginning with.are omitted.Source: GNU Coreutils:
ls.Targeta 13
Pregunta
Create a new directory.
Resposta
Use
mkdir DIRECTORY. It creates the named directory when its parent already exists.Source: GNU Coreutils:
mkdir.Targeta 14
Pregunta
Read a long text file one screen at a time.
Resposta
Use
less FILE. It is a pager: move through the file interactively and pressqto quit.Source: less: manual page.
Targeta 15
Pregunta
Write standard output to a file, replacing its previous contents.
Resposta
Use
COMMAND > FILE. The shell opens the file for output and truncates an existing regular file before the command writes to it.Source: GNU Bash: redirecting output.
Targeta 16
Pregunta
What do user, group, and other mean in a file mode?
Resposta
They are three permission classes: the owning user, the owning group, and everyone else. Each class can have read, write, and execute bits.
Source: GNU Coreutils: mode structure.
Targeta 17
Pregunta
Show a broad, user-oriented snapshot of processes on a Linux system.
Resposta
Use
ps aux. The BSD-styleaandxoptions broaden the selection, whileuselects a user-oriented format.Source: procps-ng:
ps.Targeta 18
Pregunta
Extract an uncompressed tar archive into the current directory.
Resposta
Use
tar -xf ARCHIVE.tar.-xextracts and-fnames the archive file. Review unfamiliar archive contents before extracting them.Source: GNU tar: extract.
Targeta 19
Pregunta
Copy a file to or from a remote machine over SSH.
Resposta
Use
scp SOURCE USER@HOST:DESTINATIONfor an upload, or reverse the remote and local paths for a download.Source: OpenSSH:
scp.Targeta 20
Pregunta
Print one environment variable by name.
Resposta
Use
printenv NAME, for exampleprintenv PATH. It prints that variable's value and returns a nonzero status when the name is absent.Source: GNU Coreutils:
printenv.Targeta 21
Pregunta
Check whether Bash will treat a name as an alias, function, builtin, or executable file.
Resposta
Use
type NAME. Bash reports how it would interpret the name.Source: GNU Bash:
type.Targeta 22
Pregunta
Include hidden entries in a directory listing.
Resposta
Use
ls -a. It includes names beginning with., including.and...Targeta 23
Pregunta
Copy a file to another path.
Resposta
Use
cp SOURCE DESTINATION. If the destination names an existing file,cpcan replace it, so add an interactive check when overwrites are uncertain.Source: GNU Coreutils:
cp.Targeta 24
Pregunta
Show the first 10 lines of a text file.
Resposta
Use
head FILE. Its default output is the first 10 lines; use-n NUMBERto choose another count.Source: GNU Coreutils:
head.Targeta 25
Pregunta
Append standard output to a file without replacing its existing contents.
Resposta
Use
COMMAND >> FILE. The shell opens the file in append mode, creating it if needed.Targeta 26
Pregunta
What do read, write, and execute mean on a regular file?
Resposta
Read allows reading the contents, write allows modifying the contents, and execute allows the file to be run as a program when its format is executable.
Source: GNU Coreutils: mode structure.
Targeta 27
Pregunta
Find process IDs by process name.
Resposta
Use
pgrep PATTERN. It searches currently running processes and prints matching process IDs.Source: procps-ng:
pgrep.Targeta 28
Pregunta
Compress one file with gzip while keeping the original file.
Resposta
Use
gzip -k FILE. GNU gzip writesFILE.gzand-kkeeps the input file.Source: GNU gzip manual.
Targeta 29
Pregunta
Fetch only a URL's response headers with curl.
Resposta
Use
curl -I URL. It requests headers only; the server may respond differently than it would to a normal download.Source: curl:
--head.Targeta 30
Pregunta
Make a shell variable available to commands started from this Bash session.
Resposta
Use
export NAME=value. Bash marks the name for inclusion in the environment of subsequently executed commands.Source: GNU Bash:
export.Targeta 31
Pregunta
Ask Bash which command it would run for a name.
Resposta
Use
command -v NAME. It reports the command, builtin, function, alias, or executable Bash would use, and returns a nonzero status when none is found.Source: GNU Bash:
command.Targeta 32
Pregunta
Show a long directory listing with modes, owners, sizes, and timestamps.
Resposta
Use
ls -l. The long format adds file type and mode, link count, owner, group, size, timestamp, and name.Source: GNU Coreutils: long listing format.
Targeta 33
Pregunta
Move or rename a file.
Resposta
Use
mv SOURCE DESTINATION. Within one filesystem this commonly renames the path; it can also move it to another directory.Source: GNU Coreutils:
mv.Targeta 34
Pregunta
Show the last 10 lines of a text file.
Resposta
Use
tail FILE. Its default output is the last 10 lines; use-n NUMBERto choose another count.Source: GNU Coreutils:
tail.Targeta 35
Pregunta
Give a command standard input from a file.
Resposta
Use
COMMAND < FILE. The shell opens the file for reading on the command's standard input.Source: GNU Bash: redirecting input.
Targeta 36
Pregunta
What do read, write, and execute mean on a directory?
Resposta
Read permits listing names, write permits changing directory entries, and execute permits traversal and access to entries by name. Creating or removing entries normally needs both write and execute permission.
Source: GNU Coreutils: mode structure.
Targeta 37
Pregunta
Watch a live, updating view of processes and resource use.
Resposta
Use
top. It refreshes a process and system summary interactively; pressqto quit.Source: procps-ng:
top.Targeta 38
Pregunta
Show one path's total disk usage in a human-readable summary.
Resposta
Use
du -sh PATH.-sreports one total and-hformats sizes for people.Source: GNU Coreutils:
du.Targeta 39
Pregunta
Download a URL using its remote file name.
Resposta
Use
curl -O URL. curl saves the response under the file-name part of the URL; check the target directory before downloading.Source: curl:
--remote-name.Targeta 40
Pregunta
Search Bash command history interactively.
Resposta
Press
Ctrl-Rand type part of the command. Bash Readline performs a reverse incremental search through history.Source: GNU Bash: reverse search.
Targeta 41
Pregunta
Search manual-page names and summaries by keyword.
Resposta
Use
man -k KEYWORD. It searches the manual-page database's short descriptions, likeapropos KEYWORD.Source: man-pages:
man.Targeta 42
Pregunta
Show a long listing with human-readable file sizes.
Resposta
Use
ls -lh.-lselects long format and-huses human-readable size units.Source: GNU Coreutils: block size.
Targeta 43
Pregunta
Ask before
cpoverwrites an existing destination file.Resposta
Use
cp -i SOURCE DESTINATION.-iprompts before replacing an existing destination.Source: GNU Coreutils:
cp.Targeta 44
Pregunta
Keep watching new lines appended to a log file.
Resposta
Use
tail -f FILE.-fkeeps the command running and prints data as the file grows; stop it withCtrl-C.Source: GNU Coreutils:
tail.Targeta 45
Pregunta
Write only a command's error stream to a file.
Resposta
Use
COMMAND 2> ERRORS.log. File descriptor2is standard error, so standard output stays unchanged.Source: GNU Bash: redirections.
Targeta 46
Pregunta
Give the file owner execute permission without changing the other mode bits.
Resposta
Use
chmod u+x FILE. In symbolic mode,umeans owner,+adds a bit, andxmeans execute.Source: GNU Coreutils: symbolic modes.
Targeta 47
Pregunta
Ask a process to terminate gracefully by PID.
Resposta
Use
kill PID. By default,killsendsSIGTERM, which gives the process a chance to handle the signal and clean up.Source: Linux man-pages:
kill.Targeta 48
Pregunta
Show free and used space for mounted filesystems in readable units.
Resposta
Use
df -h. It reports filesystem space and formats sizes in powers of 1024 for easier reading.Source: GNU Coreutils:
df.Targeta 49
Pregunta
Check whether a host responds to ICMP echo requests.
Resposta
Use
ping HOST. It sends ICMP echo requests and reports replies and packet statistics; a blocked reply does not prove the host is down.Source: iputils:
ping.Targeta 50
Pregunta
Create a short Bash name for a longer command.
Resposta
Use
alias NAME='COMMAND', for examplealias ll='ls -lah'. The alias lasts for the current shell unless you add it to shell startup configuration.Source: GNU Bash: aliases.
100 targetes
Linux Command Line Flashcards: Essential Commands, Flags & Workflows
Estudia aquesta baralla de francNibomo s'obre perquè puguis començar a estudiar.
Targeta 51
Pregunta
Interrupt the foreground command from the terminal.
Resposta
Press
Ctrl-C. The terminal normally sendsSIGINTto the foreground process group.Source: GNU Bash: signals.
Targeta 52
Pregunta
Change to another directory.
Resposta
Use
cd PATH.cdis a shell builtin because it changes the shell's own working directory.Source: GNU Bash:
cd.Targeta 53
Pregunta
Ask before
mvoverwrites an existing destination file.Resposta
Use
mv -i SOURCE DESTINATION.-iprompts before replacing an existing destination.Source: GNU Coreutils:
mv.Targeta 54
Pregunta
Count the lines in a text file.
Resposta
Use
wc -l FILE.-lprints the newline count.Source: GNU Coreutils:
wc.Targeta 55
Pregunta
Send standard output and standard error to the same file.
Resposta
Use
COMMAND > OUTPUT.log 2>&1. The order matters: standard error is redirected to the destination that standard output has at that point.Targeta 56
Pregunta
How do octal digits encode read, write, and execute permissions?
Resposta
Use
4for read,2for write, and1for execute, then add the values for each of user, group, and other. For example,6means read plus write.Source: GNU Coreutils: numeric modes.
Targeta 57
Pregunta
Force a process to stop only after graceful termination has failed.
Resposta
Use
kill -KILL PIDas a last resort.SIGKILLcannot be caught or ignored, so the process cannot run its normal cleanup.Source: Linux man-pages: signal.
Targeta 58
Pregunta
List block devices in a tree without changing them.
Resposta
Use
lsblk. It reads device and filesystem information and prints a tree by default.Source: util-linux:
lsblk.Targeta 59
Pregunta
Clear the display, or recover a terminal whose state is corrupted.
Resposta
Use
clearfor a normal screen clear. Useresetwhen the terminal's modes are garbled and need reinitialization.Source: ncurses:
clearandreset.Targeta 60
Pregunta
Move to the parent directory.
Resposta
Use
cd ... In a path,..names the parent directory.Source: POSIX: pathname resolution.
Targeta 61
Pregunta
Remove one file without recursive deletion.
Resposta
Use
rm FILE. It removes the named directory entry; this is not a trash operation, so verify the path first.Source: GNU Coreutils:
rm.Targeta 62
Pregunta
Print lines in a file that contain a pattern.
Resposta
Use
grep 'PATTERN' FILE. grep prints matching lines; quote the pattern so the shell does not reinterpret special characters.Source: GNU Grep manual.
Targeta 63
Pregunta
Discard a command's standard output.
Resposta
Use
COMMAND > /dev/null./dev/nulldiscards bytes written to it; standard error is still visible unless redirected separately.Source: Linux man-pages:
null.Targeta 64
Pregunta
Change a file's owning user.
Resposta
Use
chown USER FILE. Changing ownership is permission-sensitive and commonly requires elevated privileges.Source: GNU Coreutils:
chown.Targeta 65
Pregunta
List the jobs managed by the current Bash session.
Resposta
Use
jobs. It lists the shell's active jobs and their states.Source: GNU Bash: job-control builtins.
Targeta 66
Pregunta
Show kernel and system identity details in one line.
Resposta
Use
uname -a. It prints all availableunamefields, including the kernel name and release, machine, and other supported details.Source: GNU Coreutils:
uname.Targeta 67
Pregunta
Check the previous foreground pipeline's exit status in Bash.
Resposta
Read
$?immediately after the command. Bash sets it to the most recently completed foreground pipeline's status;0conventionally means success.Sources: GNU Bash: special parameters; GNU Bash: exit status.
Targeta 68
Pregunta
Return to the previous working directory.
Resposta
Use
cd -. Bash changes to$OLDPWDand prints the resulting directory.Source: GNU Bash:
cd.Targeta 69
Pregunta
Ask before removing a file.
Resposta
Use
rm -i FILE.-iprompts before each removal.Source: GNU Coreutils:
rm.Targeta 70
Pregunta
Search a file for a pattern without case distinctions.
Resposta
Use
grep -i 'PATTERN' FILE.-iignores case distinctions while matching.Source: GNU Grep: matching control.
Targeta 71
Pregunta
Show command output on screen and save a copy to a file.
Resposta
Use
COMMAND | tee FILE.teecopies standard input to standard output and to the named file.Source: GNU Coreutils:
tee.Targeta 72
Pregunta
Change a file's owning group.
Resposta
Use
chgrp GROUP FILE. The operation is limited by your ownership, group membership, and system privileges.Source: GNU Coreutils:
chgrp.Targeta 73
Pregunta
Suspend the foreground job, then continue it in the background.
Resposta
Press
Ctrl-Z, then runbg. The terminal normally stops the foreground job, and Bash resumes that job asynchronously.Source: GNU Bash: job control basics.
Targeta 74
Pregunta
Show available and used memory in human-readable units.
Resposta
Use
free -h. It reads memory counters exposed by the kernel and formats the values for people.Source: procps-ng:
free.Targeta 75
Pregunta
Change to your home directory.
Resposta
Use
cd ~or simplycdin Bash. Tilde expansion turns~into your home directory path, andcdwith no argument uses$HOME.Sources: GNU Bash: tilde expansion; GNU Bash:
cd.Targeta 76
Pregunta
Sort text lines using the current locale's default ordering.
Resposta
Use
sort FILE. It writes the sorted lines to standard output and does not change the input file unless you explicitly request an output file.Source: GNU Coreutils:
sort.Targeta 77
Pregunta
Create a nested directory path whose parents may not exist.
Resposta
Use
mkdir -p PARENT/CHILD.-pcreates missing parent directories and does not fail merely because a named directory already exists.Source: GNU Coreutils:
mkdir.Targeta 78
Pregunta
Run a second command only if the first command succeeds.
Resposta
Use
COMMAND1 && COMMAND2. Bash runs the right-hand command only when the left-hand command returns status0.Source: GNU Bash: AND and OR lists.
Targeta 79
Pregunta
Print matching lines with their line numbers.
Resposta
Use
grep -n 'PATTERN' FILE.-nprefixes each matching line with its one-based line number.Source: GNU Grep: output line prefix control.
Targeta 80
Pregunta
Set a regular file so the owner can read and write it while everyone else can only read it.
Resposta
Use
chmod 644 FILE. The digits mean ownerrw-, groupr--, and otherr--.Source: GNU Coreutils: numeric modes.
Targeta 81
Pregunta
Translate characters in a text stream.
Resposta
Use
tr SET1 SET2, reading from standard input. For example,tr '[:lower:]' '[:upper:]'maps lowercase characters to uppercase according to the locale.Source: GNU Coreutils:
tr.Targeta 82
Pregunta
Bring a Bash job back to the foreground.
Resposta
Use
fg %JOB, orfgfor the current job. Bash resumes the selected job in the foreground.Source: GNU Bash: job-control builtins.
Targeta 83
Pregunta
How does an absolute path differ from a relative path?
Resposta
An absolute path starts with
/and is resolved from the filesystem root. A relative path is resolved from the current working directory.Source: POSIX: pathname resolution.
Targeta 84
Pregunta
Find paths below the current directory whose base name matches
*.log.Resposta
Use
find . -name '*.log'. Quote the pattern sofind, not the shell, performs the name match.Source: GNU Findutils: name test.
Targeta 85
Pregunta
Remove an empty directory.
Resposta
Use
rmdir DIRECTORY. It removes directories only when they are empty, which makes it safer than a recursive removal for this task.Source: GNU Coreutils:
rmdir.Targeta 86
Pregunta
Run a fallback command only if the first command fails.
Resposta
Use
COMMAND1 || COMMAND2. Bash runs the right-hand command only when the left-hand command returns a nonzero status.Source: GNU Bash: AND and OR lists.
Targeta 87
Pregunta
Sort lines by their leading numeric value rather than lexically.
Resposta
Use
sort -n FILE. Numeric sort orders lines by numeric key value instead of lexicographic text order.Source: GNU Coreutils:
sort.Targeta 88
Pregunta
Set a directory so the owner can modify it while everyone can list and traverse it.
Resposta
Use
chmod 755 DIRECTORY. The digits mean ownerrwx, groupr-x, and otherr-x.Source: GNU Coreutils: numeric modes.
Targeta 89
Pregunta
Print one delimited field from each input line.
Resposta
Use
cut -d CHARACTER -f FIELD FILE. For example,cut -d: -f1 FILEprints the first colon-delimited field.Source: GNU Coreutils:
cut.Targeta 90
Pregunta
Start a command as an asynchronous Bash job.
Resposta
Add
&:COMMAND &. Bash starts the command in the background and returns to the prompt without waiting for it to finish.Source: GNU Bash: asynchronous lists.
Targeta 91
Pregunta
What does
./toolsay about where Bash should findtool?Resposta
It names
toolin the current directory. The./is an explicit relative path, so Bash does not need to search$PATH.Sources: POSIX: pathname resolution; GNU Bash: command search.
Targeta 92
Pregunta
Search recursively through files under a directory for matching lines.
Resposta
Use
grep -r 'PATTERN' DIRECTORY.-rreads files under each directory recursively and prints matching lines.Targeta 93
Pregunta
Create a second hard-link name for an existing file.
Resposta
Use
ln TARGET NEW_NAME. Both names refer to the same underlying file; hard links normally cannot cross filesystems or target directories.Source: GNU Coreutils: hard links.
Targeta 94
Pregunta
Keep only one line from each adjacent run of duplicate lines.
Resposta
Use
uniq. It compares adjacent lines, so sort the input first when equal lines may be separated.Source: GNU Coreutils:
uniq.Targeta 95
Pregunta
Keep every character literal in a Bash argument, including
$and spaces.Resposta
Wrap the text in single quotes:
'literal $HOME text'. Single quotes preserve each enclosed character literally; a single quote itself cannot appear directly inside that pair.Source: GNU Bash: single quotes.
Targeta 96
Pregunta
What does a path beginning with
/mean?Resposta
It is an absolute path resolved from the filesystem root directory, not from the current directory.
Source: POSIX: pathname resolution.
Targeta 97
Pregunta
Find only regular files below the current directory.
Resposta
Use
find . -type f. Theftype test matches regular files.Source: GNU Findutils: type test.
Targeta 98
Pregunta
Create a symbolic link that points to another path.
Resposta
Use
ln -s TARGET LINK_NAME. A symbolic link stores a pathname; it can cross filesystems and can become dangling if the target path disappears.Source: GNU Coreutils: symbolic links.
Targeta 99
Pregunta
Allow variable expansion but keep spaces inside one Bash argument.
Resposta
Use double quotes, for example
"$HOME/My Files". Double quotes preserve the argument while still allowing parameter expansion and command substitution.Source: GNU Bash: double quotes.
Targeta 100
Pregunta
Show how two text files differ.
Resposta
Use
diff FILE1 FILE2. It reports the changes needed to make the files match; a status of0means no differences,1means differences, and values above1mean trouble.Source: GNU Diffutils:
diff.
100 targetes
Linux Command Line Flashcards: Essential Commands, Flags & Workflows
Nibomo s'obre perquè puguis començar a estudiar.