alpaca_linux_command / alpaca_linux.csv
ilyusha07's picture
Upload alpaca_linux.csv
5aefba6 verified
instruction,input,output
What is chgrp command,,"# chgrp
> Change group ownership of files and directories. More information:
> https://www.gnu.org/software/coreutils/chgrp.
* Change the owner group of a file/directory:
`chgrp {{group}} {{path/to/file_or_directory}}`
* Recursively change the owner group of a directory and its contents:
`chgrp -R {{group}} {{path/to/directory}}`
* Change the owner group of a symbolic link:
`chgrp -h {{group}} {{path/to/symlink}}`
* Change the owner group of a file/directory to match a reference file:
`chgrp --reference={{path/to/reference_file}} {{path/to/file_or_directory}}`"
What is more command,,"# more
> Open a file for interactive reading, allowing scrolling and search. More
> information: https://manned.org/more.
* Open a file:
`more {{path/to/file}}`
* Open a file displaying from a specific line:
`more +{{line_number}} {{path/to/file}}`
* Display help:
`more --help`
* Go to the next page:
`<Space>`
* Search for a string (press `n` to go to the next match):
`/{{something}}`
* Exit:
`q`
* Display help about interactive commands:
`h`"
What is git-hash-object command,,"# git hash-object
> Computes the unique hash key of content and optionally creates an object
> with specified type. More information: https://git-scm.com/docs/git-hash-
> object.
* Compute the object ID without storing it:
`git hash-object {{path/to/file}}`
* Compute the object ID and store it in the Git database:
`git hash-object -w {{path/to/file}}`
* Compute the object ID specifying the object type:
`git hash-object -t {{blob|commit|tag|tree}} {{path/to/file}}`
* Compute the object ID from `stdin`:
`cat {{path/to/file}} | git hash-object --stdin`"
What is id command,,"# id
> Display current user and group identity. More information:
> https://www.gnu.org/software/coreutils/id.
* Display current user's ID (UID), group ID (GID) and groups to which they belong:
`id`
* Display the current user identity as a number:
`id -u`
* Display the current group identity as a number:
`id -g`
* Display an arbitrary user's ID (UID), group ID (GID) and groups to which they belong:
`id {{username}}`"
What is nl command,,"# nl
> A utility for numbering lines, either from a file, or from `stdin`. More
> information: https://www.gnu.org/software/coreutils/nl.
* Number non-blank lines in a file:
`nl {{path/to/file}}`
* Read from `stdout`:
`cat {{path/to/file}} | nl {{options}} -`
* Number only the lines with printable text:
`nl -t {{path/to/file}}`
* Number all lines including blank lines:
`nl -b a {{path/to/file}}`
* Number only the body lines that match a basic regular expression (BRE) pattern:
`nl -b p'FooBar[0-9]' {{path/to/file}}`"
What is git-check-ignore command,,"# git check-ignore
> Analyze and debug Git ignore/exclude ("".gitignore"") files. More information:
> https://git-scm.com/docs/git-check-ignore.
* Check whether a file or directory is ignored:
`git check-ignore {{path/to/file_or_directory}}`
* Check whether multiple files or directories are ignored:
`git check-ignore {{path/to/file}} {{path/to/directory}}`
* Use pathnames, one per line, from `stdin`:
`git check-ignore --stdin < {{path/to/file_list}}`
* Do not check the index (used to debug why paths were tracked and not ignored):
`git check-ignore --no-index {{path/to/files_or_directories}}`
* Include details about the matching pattern for each path:
`git check-ignore --verbose {{path/to/files_or_directories}}`"
What is tcpdump command,,"# tcpdump
> Dump traffic on a network. More information: https://www.tcpdump.org.
* List available network interfaces:
`tcpdump -D`
* Capture the traffic of a specific interface:
`tcpdump -i {{eth0}}`
* Capture all TCP traffic showing contents (ASCII) in console:
`tcpdump -A tcp`
* Capture the traffic from or to a host:
`tcpdump host {{www.example.com}}`
* Capture the traffic from a specific interface, source, destination and destination port:
`tcpdump -i {{eth0}} src {{192.168.1.1}} and dst {{192.168.1.2}} and dst port
{{80}}`
* Capture the traffic of a network:
`tcpdump net {{192.168.1.0/24}}`
* Capture all traffic except traffic over port 22 and save to a dump file:
`tcpdump -w {{dumpfile.pcap}} port not {{22}}`
* Read from a given dump file:
`tcpdump -r {{dumpfile.pcap}}`"
What is users command,,"# users
> Display a list of logged in users. See also: `useradd`, `userdel`,
> `usermod`. More information: https://www.gnu.org/software/coreutils/users.
* Print logged in usernames:
`users`
* Print logged in usernames according to a given file:
`users {{/var/log/wmtp}}`"
What is git-rev-list command,,"# git rev-list
> List revisions (commits) in reverse chronological order. More information:
> https://git-scm.com/docs/git-rev-list.
* List all commits on the current branch:
`git rev-list {{HEAD}}`
* Print the latest commit that changed (add/edit/remove) a specific file on the current branch:
`git rev-list -n 1 HEAD -- {{path/to/file}}`
* List commits more recent than a specific date, on a specific branch:
`git rev-list --since={{'2019-12-01 00:00:00'}} {{branch_name}}`
* List all merge commits on a specific commit:
`git rev-list --merges {{commit}}`
* Print the number of commits since a specific tag:
`git rev-list {{tag_name}}..HEAD --count`"
What is lpr command,,"# lpr
> CUPS tool for printing files. See also: `lpstat` and `lpadmin`. More
> information: https://www.cups.org/doc/man-lpr.html.
* Print a file to the default printer:
`lpr {{path/to/file}}`
* Print 2 copies:
`lpr -# {{2}} {{path/to/file}}`
* Print to a named printer:
`lpr -P {{printer}} {{path/to/file}}`
* Print either a single page (e.g. 2) or a range of pages (e.g. 2–16):
`lpr -o page-ranges={{2|2-16}} {{path/to/file}}`
* Print double-sided either in portrait (long) or in landscape (short):
`lpr -o sides={{two-sided-long-edge|two-sided-short-edge}} {{path/to/file}}`
* Set page size (more options may be available depending on setup):
`lpr -o media={{a4|letter|legal}} {{path/to/file}}`
* Print multiple pages per sheet:
`lpr -o number-up={{2|4|6|9|16}} {{path/to/file}}`"
What is lp command,,"# lp
> Print files. More information: https://manned.org/lp.
* Print the output of a command to the default printer (see `lpstat` command):
`echo ""test"" | lp`
* Print a file to the default printer:
`lp {{path/to/filename}}`
* Print a file to a named printer (see `lpstat` command):
`lp -d {{printer_name}} {{path/to/filename}}`
* Print N copies of file to default printer (replace N with desired number of copies):
`lp -n {{N}} {{path/to/filename}}`
* Print only certain pages to the default printer (print pages 1, 3-5, and 16):
`lp -P 1,3-5,16 {{path/to/filename}}`
* Resume printing a job:
`lp -i {{job_id}} -H resume`"
What is uptime command,,"# uptime
> Tell how long the system has been running and other information. More
> information: https://ss64.com/osx/uptime.html.
* Print current time, uptime, number of logged-in users and other information:
`uptime`"
What is git-count-objects command,,"# git count-objects
> Count the number of unpacked objects and their disk consumption. More
> information: https://git-scm.com/docs/git-count-objects.
* Count all objects and display the total disk usage:
`git count-objects`
* Display a count of all objects and their total disk usage, displaying sizes in human-readable units:
`git count-objects --human-readable`
* Display more verbose information:
`git count-objects --verbose`
* Display more verbose information, displaying sizes in human-readable units:
`git count-objects --human-readable --verbose`"
What is git-shortlog command,,"# git shortlog
> Summarizes the `git log` output. More information: https://git-
> scm.com/docs/git-shortlog.
* View a summary of all the commits made, grouped alphabetically by author name:
`git shortlog`
* View a summary of all the commits made, sorted by the number of commits made:
`git shortlog -n`
* View a summary of all the commits made, grouped by the committer identities (name and email):
`git shortlog -c`
* View a summary of the last 5 commits (i.e. specify a revision range):
`git shortlog HEAD~{{5}}..HEAD`
* View all users, emails and the number of commits in the current branch:
`git shortlog -sne`
* View all users, emails and the number of commits in all branches:
`git shortlog -sne --all`"
What is pv command,,"# pv
> Monitor the progress of data through a pipe. More information:
> https://manned.org/pv.
* Print the contents of the file and display a progress bar:
`pv {{path/to/file}}`
* Measure the speed and amount of data flow between pipes (`--size` is optional):
`command1 | pv --size {{expected_amount_of_data_for_eta}} | command2`
* Filter a file, see both progress and amount of output data:
`pv -cN in {{big_text_file}} | grep {{pattern}} | pv -cN out >
{{filtered_file}}`
* Attach to an already running process and see its file reading progress:
`pv -d {{PID}}`
* Read an erroneous file, skip errors as `dd conv=sync,noerror` would:
`pv -EE {{path/to/faulty_media}} > image.img`
* Stop reading after reading specified amount of data, rate limit to 1K/s:
`pv -L 1K --stop-at --size {{maximum_file_size_to_be_read}}`"
What is nl command,,"# nl
> A utility for numbering lines, either from a file, or from `stdin`. More
> information: https://www.gnu.org/software/coreutils/nl.
* Number non-blank lines in a file:
`nl {{path/to/file}}`
* Read from `stdout`:
`cat {{path/to/file}} | nl {{options}} -`
* Number only the lines with printable text:
`nl -t {{path/to/file}}`
* Number all lines including blank lines:
`nl -b a {{path/to/file}}`
* Number only the body lines that match a basic regular expression (BRE) pattern:
`nl -b p'FooBar[0-9]' {{path/to/file}}`"
What is git-svn command,,"# git svn
> Bidirectional operation between a Subversion repository and Git. More
> information: https://git-scm.com/docs/git-svn.
* Clone an SVN repository:
`git svn clone {{https://example.com/subversion_repo}} {{local_dir}}`
* Clone an SVN repository starting at a given revision number:
`git svn clone -r{{1234}}:HEAD {{https://svn.example.net/subversion/repo}}
{{local_dir}}`
* Update local clone from the remote SVN repository:
`git svn rebase`
* Fetch updates from the remote SVN repository without changing the Git HEAD:
`git svn fetch`
* Commit back to the SVN repository:
`git svn dcommit`"
What is grep command,,"# grep
> Find patterns in files using regular expressions. More information:
> https://www.gnu.org/software/grep/manual/grep.html.
* Search for a pattern within a file:
`grep ""{{search_pattern}}"" {{path/to/file}}`
* Search for an exact string (disables regular expressions):
`grep --fixed-strings ""{{exact_string}}"" {{path/to/file}}`
* Search for a pattern in all files recursively in a directory, showing line numbers of matches, ignoring binary files:
`grep --recursive --line-number --binary-files={{without-match}}
""{{search_pattern}}"" {{path/to/directory}}`
* Use extended regular expressions (supports `?`, `+`, `{}`, `()` and `|`), in case-insensitive mode:
`grep --extended-regexp --ignore-case ""{{search_pattern}}"" {{path/to/file}}`
* Print 3 lines of context around, before, or after each match:
`grep --{{context|before-context|after-context}}={{3}} ""{{search_pattern}}""
{{path/to/file}}`
* Print file name and line number for each match with color output:
`grep --with-filename --line-number --color=always ""{{search_pattern}}""
{{path/to/file}}`
* Search for lines matching a pattern, printing only the matched text:
`grep --only-matching ""{{search_pattern}}"" {{path/to/file}}`
* Search `stdin` for lines that do not match a pattern:
`cat {{path/to/file}} | grep --invert-match ""{{search_pattern}}""`"
What is systemd-run command,,"# systemd-run
> Run programs in transient scope units, service units, or path-, socket-, or
> timer-triggered service units. More information:
> https://www.freedesktop.org/software/systemd/man/systemd-run.html.
* Start a transient service:
`sudo systemd-run {{command}} {{argument1 argument2 ...}}`
* Start a transient service under the service manager of the current user (no privileges):
`systemd-run --user {{command}} {{argument1 argument2 ...}}`
* Start a transient service with a custom unit name and description:
`sudo systemd-run --unit={{name}} --description={{string}} {{command}}
{{argument1 argument2 ...}}`
* Start a transient service that does not get cleaned up after it terminates with a custom environment variable:
`sudo systemd-run --remain-after-exit --set-env={{name}}={{value}} {{command}}
{{argument1 argument2 ...}}`
* Start a transient timer that periodically runs its transient service (see `man systemd.time` for calendar event format):
`sudo systemd-run --on-calendar={{calendar_event}} {{command}} {{argument1
argument2 ...}}`
* Share the terminal with the program (allowing interactive input/output) and make sure the execution details remain after the program exits:
`systemd-run --remain-after-exit --pty {{command}}`
* Set properties (e.g. CPUQuota, MemoryMax) of the process and wait until it exits:
`systemd-run --property MemoryMax={{memory_in_bytes}} --property
CPUQuota={{percentage_of_CPU_time}}% --wait {{command}}`
* Use the program in a shell pipeline:
`{{command1}} | systemd-run --pipe {{command2}} | {{command3}}`"
What is tput command,,"# tput
> View and modify terminal settings and capabilities. More information:
> https://manned.org/tput.
* Move the cursor to a screen location:
`tput cup {{row}} {{column}}`
* Set foreground (af) or background (ab) color:
`tput {{setaf|setab}} {{ansi_color_code}}`
* Show number of columns, lines, or colors:
`tput {{cols|lines|colors}}`
* Ring the terminal bell:
`tput bel`
* Reset all terminal attributes:
`tput sgr0`
* Enable or disable word wrap:
`tput {{smam|rmam}}`"
What is link command,,"# link
> Create a hard link to an existing file. For more options, see the `ln`
> command. More information: https://www.gnu.org/software/coreutils/link.
* Create a hard link from a new file to an existing file:
`link {{path/to/existing_file}} {{path/to/new_file}}`"
What is logname command,,"# logname
> Shows the user's login name. More information:
> https://www.gnu.org/software/coreutils/logname.
* Display the currently logged in user's name:
`logname`"
What is iconv command,,"# iconv
> Converts text from one encoding to another. More information:
> https://manned.org/iconv.
* Convert file to a specific encoding, and print to `stdout`:
`iconv -f {{from_encoding}} -t {{to_encoding}} {{input_file}}`
* Convert file to the current locale's encoding, and output to a file:
`iconv -f {{from_encoding}} {{input_file}} > {{output_file}}`
* List supported encodings:
`iconv -l`"
What is paste command,,"# paste
> Merge lines of files. More information:
> https://www.gnu.org/software/coreutils/paste.
* Join all the lines into a single line, using TAB as delimiter:
`paste -s {{path/to/file}}`
* Join all the lines into a single line, using the specified delimiter:
`paste -s -d {{delimiter}} {{path/to/file}}`
* Merge two files side by side, each in its column, using TAB as delimiter:
`paste {{file1}} {{file2}}`
* Merge two files side by side, each in its column, using the specified delimiter:
`paste -d {{delimiter}} {{file1}} {{file2}}`
* Merge two files, with lines added alternatively:
`paste -d '\n' {{file1}} {{file2}}`"
What is ls command,,"# ls
> List directory contents. More information:
> https://www.gnu.org/software/coreutils/ls.
* List files one per line:
`ls -1`
* List all files, including hidden files:
`ls -a`
* List all files, with trailing `/` added to directory names:
`ls -F`
* Long format list (permissions, ownership, size, and modification date) of all files:
`ls -la`
* Long format list with size displayed using human-readable units (KiB, MiB, GiB):
`ls -lh`
* Long format list sorted by size (descending):
`ls -lS`
* Long format list of all files, sorted by modification date (oldest first):
`ls -ltr`
* Only list directories:
`ls -d */`"
What is mktemp command,,"# mktemp
> Create a temporary file or directory. More information:
> https://ss64.com/osx/mktemp.html.
* Create an empty temporary file and print the absolute path to it:
`mktemp`
* Create an empty temporary file with a given suffix and print the absolute path to file:
`mktemp --suffix ""{{.ext}}""`
* Create a temporary directory and print the absolute path to it:
`mktemp -d`"
What is git-range-diff command,,"# git range-diff
> Compare two commit ranges (e.g. two versions of a branch). More information:
> https://git-scm.com/docs/git-range-diff.
* Diff the changes of two individual commits:
`git range-diff {{commit_1}}^! {{commit_2}}^!`
* Diff the changes of ours and theirs from their common ancestor, e.g. after an interactive rebase:
`git range-diff {{theirs}}...{{ours}}`
* Diff the changes of two commit ranges, e.g. to check whether conflicts have been resolved appropriately when rebasing commits from `base1` to `base2`:
`git range-diff {{base1}}..{{rev1}} {{base2}}..{{rev2}}`"
What is quilt command,,"# quilt
> Tool to manage a series of patches. More information:
> https://savannah.nongnu.org/projects/quilt.
* Import an existing patch from a file:
`quilt import {{path/to/filename.patch}}`
* Create a new patch:
`quilt new {{filename.patch}}`
* Add a file to the current patch:
`quilt add {{path/to/file}}`
* After editing the file, refresh the current patch with the changes:
`quilt refresh`
* Apply all the patches in the series file:
`quilt push -a`
* Remove all applied patches:
`quilt pop -a`"
What is nohup command,,"# nohup
> Allows for a process to live when the terminal gets killed. More
> information: https://www.gnu.org/software/coreutils/nohup.
* Run a process that can live beyond the terminal:
`nohup {{command}} {{argument1 argument2 ...}}`
* Launch `nohup` in background mode:
`nohup {{command}} {{argument1 argument2 ...}} &`
* Run a shell script that can live beyond the terminal:
`nohup {{path/to/script.sh}} &`
* Run a process and write the output to a specific file:
`nohup {{command}} {{argument1 argument2 ...}} > {{path/to/output_file}} &`"
What is expand command,,"# expand
> Convert tabs to spaces. More information:
> https://www.gnu.org/software/coreutils/expand.
* Convert tabs in each file to spaces, writing to `stdout`:
`expand {{path/to/file}}`
* Convert tabs to spaces, reading from `stdin`:
`expand`
* Do not convert tabs after non blanks:
`expand -i {{path/to/file}}`
* Have tabs a certain number of characters apart, not 8:
`expand -t={{number}} {{path/to/file}}`
* Use a comma separated list of explicit tab positions:
`expand -t={{1,4,6}}`"
What is strace command,,"# strace
> Troubleshooting tool for tracing system calls. More information:
> https://manned.org/strace.
* Start tracing a specific process by its PID:
`strace -p {{pid}}`
* Trace a process and filter output by system call:
`strace -p {{pid}} -e {{system_call_name}}`
* Count time, calls, and errors for each system call and report a summary on program exit:
`strace -p {{pid}} -c`
* Show the time spent in every system call:
`strace -p {{pid}} -T`
* Start tracing a program by executing it:
`strace {{program}}`
* Start tracing file operations of a program:
`strace -e trace=file {{program}}`"
What is cmp command,,"# cmp
> Compare two files byte by byte. More information:
> https://www.gnu.org/software/diffutils/manual/html_node/Invoking-cmp.html.
* Output char and line number of the first difference between two files:
`cmp {{path/to/file1}} {{path/to/file2}}`
* Output info of the first difference: char, line number, bytes, and values:
`cmp --print-bytes {{path/to/file1}} {{path/to/file2}}`
* Output the byte numbers and values of every difference:
`cmp --verbose {{path/to/file1}} {{path/to/file2}}`
* Compare files but output nothing, yield only the exit status:
`cmp --quiet {{path/to/file1}} {{path/to/file2}}`"
What is chmod command,,"# chmod
> Change the access permissions of a file or directory. More information:
> https://www.gnu.org/software/coreutils/chmod.
* Give the [u]ser who owns a file the right to e[x]ecute it:
`chmod u+x {{path/to/file}}`
* Give the [u]ser rights to [r]ead and [w]rite to a file/directory:
`chmod u+rw {{path/to/file_or_directory}}`
* Remove e[x]ecutable rights from the [g]roup:
`chmod g-x {{path/to/file}}`
* Give [a]ll users rights to [r]ead and e[x]ecute:
`chmod a+rx {{path/to/file}}`
* Give [o]thers (not in the file owner's group) the same rights as the [g]roup:
`chmod o=g {{path/to/file}}`
* Remove all rights from [o]thers:
`chmod o= {{path/to/file}}`
* Change permissions recursively giving [g]roup and [o]thers the ability to [w]rite:
`chmod -R g+w,o+w {{path/to/directory}}`
* Recursively give [a]ll users [r]ead permissions to files and e[X]ecute permissions to sub-directories within a directory:
`chmod -R a+rX {{path/to/directory}}`"
What is chsh command,,"# chsh
> Change user's login shell. More information: https://manned.org/chsh.
* Set a specific login shell for the current user interactively:
`chsh`
* Set a specific login [s]hell for the current user:
`chsh -s {{path/to/shell}}`
* Set a login [s]hell for a specific user:
`chsh -s {{path/to/shell}} {{username}}`
* [l]ist available shells:
`chsh -l`"
What is coredumpctl command,,"# coredumpctl
> Retrieve and process saved core dumps and metadata. More information:
> https://www.freedesktop.org/software/systemd/man/coredumpctl.html.
* List all captured core dumps:
`coredumpctl list`
* List captured core dumps for a program:
`coredumpctl list {{program}}`
* Show information about the core dumps matching a program with `PID`:
`coredumpctl info {{PID}}`
* Invoke debugger using the last core dump of a program:
`coredumpctl debug {{program}}`
* Extract the last core dump of a program to a file:
`coredumpctl --output={{path/to/file}} dump {{program}}`"
What is git-check-mailmap command,,"# git check-mailmap
> Show canonical names and email addresses of contacts. More information:
> https://git-scm.com/docs/git-check-mailmap.
* Look up the canonical name associated with an email address:
`git check-mailmap ""<{{email@example.com}}>""`"
What is top command,,"# top
> Display dynamic real-time information about running processes. More
> information: https://ss64.com/osx/top.html.
* Start `top`, all options are available in the interface:
`top`
* Start `top` sorting processes by internal memory size (default order - process ID):
`top -o mem`
* Start `top` sorting processes first by CPU, then by running time:
`top -o cpu -O time`
* Start `top` displaying only processes owned by given user:
`top -user {{user_name}}`
* Get help about interactive commands:
`?`"
What is unshare command,,"# unshare
> Execute a command in new user-defined namespaces. More information:
> https://www.kernel.org/doc/html/latest/userspace-api/unshare.html.
* Execute a command without sharing access to connected networks:
`unshare --net {{command}} {{command_arguments}}`
* Execute a command as a child process without sharing mounts, processes, or networks:
`unshare --mount --pid --net --fork {{command}} {{command_arguments}}`"
What is git-switch command,,"# git switch
> Switch between Git branches. Requires Git version 2.23+. See also `git
> checkout`. More information: https://git-scm.com/docs/git-switch.
* Switch to an existing branch:
`git switch {{branch_name}}`
* Create a new branch and switch to it:
`git switch --create {{branch_name}}`
* Create a new branch based on an existing commit and switch to it:
`git switch --create {{branch_name}} {{commit}}`
* Switch to the previous branch:
`git switch -`
* Switch to a branch and update all submodules to match:
`git switch --recurse-submodules {{branch_name}}`
* Switch to a branch and automatically merge the current branch and any uncommitted changes into it:
`git switch --merge {{branch_name}}`"
What is dpkg command,,"# dpkg
> Debian package manager. Some subcommands such as `dpkg deb` have their own
> usage documentation. For equivalent commands in other package managers, see
> https://wiki.archlinux.org/title/Pacman/Rosetta. More information:
> https://manpages.debian.org/latest/dpkg/dpkg.html.
* Install a package:
`dpkg -i {{path/to/file.deb}}`
* Remove a package:
`dpkg -r {{package}}`
* List installed packages:
`dpkg -l {{pattern}}`
* List a package's contents:
`dpkg -L {{package}}`
* List contents of a local package file:
`dpkg -c {{path/to/file.deb}}`
* Find out which package owns a file:
`dpkg -S {{path/to/file}}`"
What is m4 command,,"# m4
> Macro processor. More information: https://www.gnu.org/software/m4.
* Process macros in a file:
`m4 {{path/to/file}}`
* Define a macro before processing files:
`m4 -D{{macro_name}}={{macro_value}} {{path/to/file}}`"
What is git-check-ref-format command,,"# git check-ref-format
> Checks if a given refname is acceptable, and exits with a non-zero status if
> it is not. More information: https://git-scm.com/docs/git-check-ref-format.
* Check the format of the specified refname:
`git check-ref-format {{refs/head/refname}}`
* Print the name of the last branch checked out:
`git check-ref-format --branch @{-1}`
* Normalize a refname:
`git check-ref-format --normalize {{refs/head/refname}}`"
What is date command,,"# date
> Set or display the system date. More information:
> https://ss64.com/osx/date.html.
* Display the current date using the default locale's format:
`date +%c`
* Display the current date in UTC and ISO 8601 format:
`date -u +%Y-%m-%dT%H:%M:%SZ`
* Display the current date as a Unix timestamp (seconds since the Unix epoch):
`date +%s`
* Display a specific date (represented as a Unix timestamp) using the default format:
`date -r 1473305798`"
What is git-rebase command,,"# git rebase
> Reapply commits from one branch on top of another branch. Commonly used to
> ""move"" an entire branch to another base, creating copies of the commits in
> the new location. More information: https://git-scm.com/docs/git-rebase.
* Rebase the current branch on top of another specified branch:
`git rebase {{new_base_branch}}`
* Start an interactive rebase, which allows the commits to be reordered, omitted, combined or modified:
`git rebase -i {{target_base_branch_or_commit_hash}}`
* Continue a rebase that was interrupted by a merge failure, after editing conflicting files:
`git rebase --continue`
* Continue a rebase that was paused due to merge conflicts, by skipping the conflicted commit:
`git rebase --skip`
* Abort a rebase in progress (e.g. if it is interrupted by a merge conflict):
`git rebase --abort`
* Move part of the current branch onto a new base, providing the old base to start from:
`git rebase --onto {{new_base}} {{old_base}}`
* Reapply the last 5 commits in-place, stopping to allow them to be reordered, omitted, combined or modified:
`git rebase -i {{HEAD~5}}`
* Auto-resolve any conflicts by favoring the working branch version (`theirs` keyword has reversed meaning in this case):
`git rebase -X theirs {{branch_name}}`"
What is git-commit-graph command,,"# git commit-graph
> Write and verify Git commit-graph files. More information: https://git-
> scm.com/docs/git-commit-graph.
* Write a commit-graph file for the packed commits in the repository's local `.git` directory:
`git commit-graph write`
* Write a commit-graph file containing all reachable commits:
`git show-ref --hash | git commit-graph write --stdin-commits`
* Write a commit-graph file containing all commits in the current commit-graph file along with those reachable from `HEAD`:
`git rev-parse {{HEAD}} | git commit-graph write --stdin-commits --append`"
What is chroot command,,"# chroot
> Run command or interactive shell with special root directory. More
> information: https://www.gnu.org/software/coreutils/chroot.
* Run command as new root directory:
`chroot {{path/to/new/root}} {{command}}`
* Specify user and group (ID or name) to use:
`chroot --userspec={{user:group}}`"
What is mesg command,,"# mesg
> Check or set a terminal's ability to receive messages from other users,
> usually from the write command. See also `write`. More information:
> https://manned.org/mesg.
* Check terminal's openness to write messages:
`mesg`
* Disable receiving messages from the write command:
`mesg n`
* Enable receiving messages from the write command:
`mesg y`"
What is grep command,,"# grep
> Find patterns in files using regular expressions. More information:
> https://www.gnu.org/software/grep/manual/grep.html.
* Search for a pattern within a file:
`grep ""{{search_pattern}}"" {{path/to/file}}`
* Search for an exact string (disables regular expressions):
`grep --fixed-strings ""{{exact_string}}"" {{path/to/file}}`
* Search for a pattern in all files recursively in a directory, showing line numbers of matches, ignoring binary files:
`grep --recursive --line-number --binary-files={{without-match}}
""{{search_pattern}}"" {{path/to/directory}}`
* Use extended regular expressions (supports `?`, `+`, `{}`, `()` and `|`), in case-insensitive mode:
`grep --extended-regexp --ignore-case ""{{search_pattern}}"" {{path/to/file}}`
* Print 3 lines of context around, before, or after each match:
`grep --{{context|before-context|after-context}}={{3}} ""{{search_pattern}}""
{{path/to/file}}`
* Print file name and line number for each match with color output:
`grep --with-filename --line-number --color=always ""{{search_pattern}}""
{{path/to/file}}`
* Search for lines matching a pattern, printing only the matched text:
`grep --only-matching ""{{search_pattern}}"" {{path/to/file}}`
* Search `stdin` for lines that do not match a pattern:
`cat {{path/to/file}} | grep --invert-match ""{{search_pattern}}""`"
What is less command,,"# less
> Open a file for interactive reading, allowing scrolling and search. More
> information: https://greenwoodsoftware.com/less/.
* Open a file:
`less {{source_file}}`
* Page down/up:
`<Space> (down), b (up)`
* Go to end/start of file:
`G (end), g (start)`
* Forward search for a string (press `n`/`N` to go to next/previous match):
`/{{something}}`
* Backward search for a string (press `n`/`N` to go to next/previous match):
`?{{something}}`
* Follow the output of the currently opened file:
`F`
* Open the current file in an editor:
`v`
* Exit:
`q`"
What is git-add command,,"# git add
> Adds changed files to the index. More information: https://git-
> scm.com/docs/git-add.
* Add a file to the index:
`git add {{path/to/file}}`
* Add all files (tracked and untracked):
`git add -A`
* Only add already tracked files:
`git add -u`
* Also add ignored files:
`git add -f`
* Interactively stage parts of files:
`git add -p`
* Interactively stage parts of a given file:
`git add -p {{path/to/file}}`
* Interactively stage a file:
`git add -i`"
What is indent command,,"# indent
> Change the appearance of a C/C++ program by inserting or deleting
> whitespace. More information:
> https://www.freebsd.org/cgi/man.cgi?query=indent.
* Format C/C++ source according to the Berkeley style:
`indent {{path/to/source_file.c}} {{path/to/indented_file.c}} -nbad -nbap -bc
-br -c33 -cd33 -cdb -ce -ci4 -cli0 -di16 -fc1 -fcb -i4 -ip -l75 -lp -npcs
-nprs -psl -sc -nsob -ts8`
* Format C/C++ source according to the style of Kernighan & Ritchie (K&R):
`indent {{path/to/source_file.c}} {{path/to/indented_file.c}} -nbad -bap -nbc
-br -c33 -cd33 -ncdb -ce -ci4 -cli0 -cs -d0 -di1 -nfc1 -nfcb -i4 -nip -l75 -lp
-npcs -nprs -npsl -nsc -nsob`"
What is stty command,,"# stty
> Set options for a terminal device interface. More information:
> https://www.gnu.org/software/coreutils/stty.
* Display all settings for the current terminal:
`stty --all`
* Set the number of rows or columns:
`stty {{rows|cols}} {{count}}`
* Get the actual transfer speed of a device:
`stty --file {{path/to/device_file}} speed`
* Reset all modes to reasonable values for the current terminal:
`stty sane`"
What is git-column command,,"# git column
> Display data in columns. More information: https://git-scm.com/docs/git-
> column.
* Format `stdin` as multiple columns:
`ls | git column --mode={{column}}`
* Format `stdin` as multiple columns with a maximum width of `100`:
`ls | git column --mode=column --width={{100}}`
* Format `stdin` as multiple columns with a maximum padding of `30`:
`ls | git column --mode=column --padding={{30}}`"
What is who command,,"# who
> Display who is logged in and related data (processes, boot time). More
> information: https://www.gnu.org/software/coreutils/who.
* Display the username, line, and time of all currently logged-in sessions:
`who`
* Display information only for the current terminal session:
`who am i`
* Display all available information:
`who -a`
* Display all available information with table headers:
`who -a -H`"
What is git-notes command,,"# git notes
> Add or inspect object notes. More information: https://git-scm.com/docs/git-
> notes.
* List all notes and the objects they are attached to:
`git notes list`
* List all notes attached to a given object (defaults to HEAD):
`git notes list [{{object}}]`
* Show the notes attached to a given object (defaults to HEAD):
`git notes show [{{object}}]`
* Append a note to a specified object (opens the default text editor):
`git notes append {{object}}`
* Append a note to a specified object, specifying the message:
`git notes append --message=""{{message_text}}""`
* Edit an existing note (defaults to HEAD):
`git notes edit [{{object}}]`
* Copy a note from one object to another:
`git notes copy {{source_object}} {{target_object}}`
* Remove all the notes added to a specified object:
`git notes remove {{object}}`"
What is git-mv command,,"# git mv
> Move or rename files and update the Git index. More information:
> https://git-scm.com/docs/git-mv.
* Move a file inside the repo and add the movement to the next commit:
`git mv {{path/to/file}} {{new/path/to/file}}`
* Rename a file or directory and add the renaming to the next commit:
`git mv {{path/to/file_or_directory}} {{path/to/destination}}`
* Overwrite the file or directory in the target path if it exists:
`git mv --force {{path/to/file_or_directory}} {{path/to/destination}}`"
What is strip command,,"# strip
> Discard symbols from executables or object files. More information:
> https://manned.org/strip.
* Replace the input file with its stripped version:
`strip {{path/to/file}}`
* Strip symbols from a file, saving the output to a specific file:
`strip {{path/to/input_file}} -o {{path/to/output_file}}`
* Strip debug symbols only:
`strip --strip-debug {{path/to/file.o}}`"
What is bash command,,"# bash
> Bourne-Again SHell, an `sh`-compatible command-line interpreter. See also:
> `zsh`, `histexpand` (history expansion). More information:
> https://gnu.org/software/bash/.
* Start an interactive shell session:
`bash`
* Start an interactive shell session without loading startup configs:
`bash --norc`
* Execute specific [c]ommands:
`bash -c ""{{echo 'bash is executed'}}""`
* Execute a specific script:
`bash {{path/to/script.sh}}`
* Execute a specific script while printing each command before executing it:
`bash -x {{path/to/script.sh}}`
* Execute a specific script and stop at the first [e]rror:
`bash -e {{path/to/script.sh}}`
* Execute specific commands from `stdin`:
`{{echo ""echo 'bash is executed'""}} | bash`
* Start a [r]estricted shell session:
`bash -r`"
What is exit command,,"# exit
> Exit the shell. More information: https://manned.org/exit.
* Exit the shell with the exit code of the last command executed:
`exit`
* Exit the shell with the specified exit code:
`exit {{exit_code}}`"
What is uniq command,,"# uniq
> Output the unique lines from the given input or file. Since it does not
> detect repeated lines unless they are adjacent, we need to sort them first.
> More information: https://www.gnu.org/software/coreutils/uniq.
* Display each line once:
`sort {{path/to/file}} | uniq`
* Display only unique lines:
`sort {{path/to/file}} | uniq -u`
* Display only duplicate lines:
`sort {{path/to/file}} | uniq -d`
* Display number of occurrences of each line along with that line:
`sort {{path/to/file}} | uniq -c`
* Display number of occurrences of each line, sorted by the most frequent:
`sort {{path/to/file}} | uniq -c | sort -nr`"
What is git-mailinfo command,,"# git mailinfo
> Extract patch and authorship information from a single email message. More
> information: https://git-scm.com/docs/git-mailinfo.
* Extract the patch and author data from an email message:
`git mailinfo {{message|patch}}`
* Extract but remove leading and trailing whitespace:
`git mailinfo -k {{message|patch}}`
* Remove everything from the body before a scissors line (e.g. ""-->* --"") and retrieve the message or patch:
`git mailinfo --scissors {{message|patch}}`"
What is git-annotate command,,"# git annotate
> Show commit hash and last author on each line of a file. See `git blame`,
> which is preferred over `git annotate`. `git annotate` is provided for those
> familiar with other version control systems. More information: https://git-
> scm.com/docs/git-annotate.
* Print a file with the author name and commit hash prepended to each line:
`git annotate {{path/to/file}}`
* Print a file with the author email and commit hash prepended to each line:
`git annotate -e {{path/to/file}}`
* Print only rows that match a regular expression:
`git annotate -L :{{regexp}} {{path/to/file}}`"
What is pstree command,,"# pstree
> A convenient tool to show running processes as a tree. More information:
> https://manned.org/pstree.
* Display a tree of processes:
`pstree`
* Display a tree of processes with PIDs:
`pstree -p`
* Display all process trees rooted at processes owned by specified user:
`pstree {{user}}`"
What is ac command,,"# ac
> Print statistics on how long users have been connected. More information:
> https://man.openbsd.org/ac.
* Print how long the current user has been connected in hours:
`ac`
* Print how long users have been connected in hours:
`ac -p`
* Print how long a particular user has been connected in hours:
`ac -p {{username}}`
* Print how long a particular user has been connected in hours per day (with total):
`ac -dp {{username}}`"
What is sha1sum command,,"# sha1sum
> Calculate SHA1 cryptographic checksums. More information:
> https://www.gnu.org/software/coreutils/sha1sum.
* Calculate the SHA1 checksum for one or more files:
`sha1sum {{path/to/file1 path/to/file2 ...}}`
* Calculate and save the list of SHA1 checksums to a file:
`sha1sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha1}}`
* Calculate a SHA1 checksum from `stdin`:
`{{command}} | sha1sum`
* Read a file of SHA1 sums and filenames and verify all files have matching checksums:
`sha1sum --check {{path/to/file.sha1}}`
* Only show a message for missing files or when verification fails:
`sha1sum --check --quiet {{path/to/file.sha1}}`
* Only show a message when verification fails, ignoring missing files:
`sha1sum --ignore-missing --check --quiet {{path/to/file.sha1}}`"
What is ed command,,"# ed
> The original Unix text editor. See also: `awk`, `sed`. More information:
> https://www.gnu.org/software/ed/manual/ed_manual.html.
* Start an interactive editor session with an empty document:
`ed`
* Start an interactive editor session with an empty document and a specific [p]rompt:
`ed -p '> '`
* Start an interactive editor session with an empty document and without diagnostics, byte counts and '!' prompt:
`ed -s`
* Edit a specific file (this shows the byte count of the loaded file):
`ed {{path/to/file}}`
* Replace a string with a specific replacement for all lines:
`,s/{{regular_expression}}/{{replacement}}/g`"
What is systemd-analyze command,,"# systemd-analyze
> Analyze and debug system manager. Show timing details about the boot process
> of units (services, mount points, devices, sockets). More information:
> https://www.freedesktop.org/software/systemd/man/systemd-analyze.html.
* List all running units, ordered by the time they took to initialize:
`systemd-analyze blame`
* Print a tree of the time-critical chain of units:
`systemd-analyze critical-chain`
* Create an SVG file showing when each system service started, highlighting the time that they spent on initialization:
`systemd-analyze plot > {{path/to/file.svg}}`
* Plot a dependency graph and convert it to an SVG file:
`systemd-analyze dot | dot -T{{svg}} > {{path/to/file.svg}}`
* Show security scores of running units:
`systemd-analyze security`"
What is timeout command,,"# timeout
> Run a command with a time limit. More information:
> https://www.gnu.org/software/coreutils/timeout.
* Run `sleep 10` and terminate it, if it runs for more than 3 seconds:
`timeout {{3s}} {{sleep 10}}`
* Specify the signal to be sent to the command after the time limit expires. (By default, TERM is sent):
`timeout --signal {{INT}} {{5s}} {{sleep 10}}`"
What is git-am command,,"# git am
> Apply patch files and create a commit. Useful when receiving commits via
> email. See also `git format-patch`, which can generate patch files. More
> information: https://git-scm.com/docs/git-am.
* Apply and commit changes following a local patch file:
`git am {{path/to/file.patch}}`
* Apply and commit changes following a remote patch file:
`curl -L {{https://example.com/file.patch}} | git apply`
* Abort the process of applying a patch file:
`git am --abort`
* Apply as much of a patch file as possible, saving failed hunks to reject files:
`git am --reject {{path/to/file.patch}}`"
What is strings command,,"# strings
> Find printable strings in an object file or binary. More information:
> https://manned.org/strings.
* Print all strings in a binary:
`strings {{path/to/file}}`
* Limit results to strings at least length characters long:
`strings -n {{length}} {{path/to/file}}`
* Prefix each result with its offset within the file:
`strings -t d {{path/to/file}}`
* Prefix each result with its offset within the file in hexadecimal:
`strings -t x {{path/to/file}}`"
What is git-pull command,,"# git pull
> Fetch branch from a remote repository and merge it to local repository. More
> information: https://git-scm.com/docs/git-pull.
* Download changes from default remote repository and merge it:
`git pull`
* Download changes from default remote repository and use fast-forward:
`git pull --rebase`
* Download changes from given remote repository and branch, then merge them into HEAD:
`git pull {{remote_name}} {{branch}}`"
What is yacc command,,"# yacc
> Generate an LALR parser (in C) with a given formal grammar specification
> file. See also: `bison`. More information: https://manned.org/man/yacc.1p.
* Create a file `y.tab.c` containing the C parser code and compile the grammar file with all necessary constant declarations for values. (Constant declarations file `y.tab.h` is created only when the `-d` flag is used):
`yacc -d {{path/to/grammar_file.y}}`
* Compile a grammar file containing the description of the parser and a report of conflicts generated by ambiguities in the grammar:
`yacc -d {{path/to/grammar_file.y}} -v`
* Compile a grammar file, and prefix output filenames with `prefix` instead of `y`:
`yacc -d {{path/to/grammar_file.y}} -v -b {{prefix}}`"
What is df command,,"# df
> Gives an overview of the filesystem disk space usage. More information:
> https://www.gnu.org/software/coreutils/df.
* Display all filesystems and their disk usage:
`df`
* Display all filesystems and their disk usage in human-readable form:
`df -h`
* Display the filesystem and its disk usage containing the given file or directory:
`df {{path/to/file_or_directory}}`
* Display statistics on the number of free inodes:
`df -i`
* Display filesystems but exclude the specified types:
`df -x {{squashfs}} -x {{tmpfs}}`"
What is ipcmk command,,"# ipcmk
> Create IPC (Inter-process Communication) resources. More information:
> https://manned.org/ipcmk.
* Create a shared memory segment:
`ipcmk --shmem {{segment_size_in_bytes}}`
* Create a semaphore:
`ipcmk --semaphore {{element_size}}`
* Create a message queue:
`ipcmk --queue`
* Create a shared memory segment with specific permissions (default is 0644):
`ipcmk --shmem {{segment_size_in_bytes}} {{octal_permissions}}`"
What is newgrp command,,"# newgrp
> Switch primary group membership. More information:
> https://manned.org/newgrp.
* Change user's primary group membership:
`newgrp {{group_name}}`
* Reset primary group membership to user's default group in `/etc/passwd`:
`newgrp`"
What is ssh-agent command,,"# ssh-agent
> Spawn an SSH Agent process. An SSH Agent holds SSH keys decrypted in memory
> until removed or the process is killed. See also `ssh-add`, which can add
> and manage keys held by an SSH Agent. More information:
> https://man.openbsd.org/ssh-agent.
* Start an SSH Agent for the current shell:
`eval $(ssh-agent)`
* Kill the currently running agent:
`ssh-agent -k`"
What is basenc command,,"# basenc
> Encode or decode file or `stdin` using a specified encoding, to `stdout`.
> More information: https://www.gnu.org/software/coreutils/basenc.
* Encode a file with base64 encoding:
`basenc --base64 {{path/to/file}}`
* Decode a file with base64 encoding:
`basenc --decode --base64 {{path/to/file}}`
* Encode from `stdin` with base32 encoding with 42 columns:
`{{command}} | basenc --base32 -w42`
* Encode from `stdin` with base32 encoding:
`{{command}} | basenc --base32`"
What is locale command,,"# locale
> Get locale-specific information. More information:
> https://manned.org/locale.
* List all global environment variables describing the user's locale:
`locale`
* List all available locales:
`locale --all-locales`
* Display all available locales and the associated metadata:
`locale --all-locales --verbose`
* Display the current date format:
`locale date_fmt`"
What is unlink command,,"# unlink
> Remove a link to a file from the filesystem. The file contents is lost if
> the link is the last one to the file. More information:
> https://www.gnu.org/software/coreutils/unlink.
* Remove the specified file if it is the last link:
`unlink {{path/to/file}}`"
What is diff3 command,,"# diff3
> Compare three files line by line. More information:
> https://www.gnu.org/software/diffutils/manual/html_node/Invoking-diff3.html.
* Compare files:
`diff3 {{path/to/file1}} {{path/to/file2}} {{path/to/file3}}`
* Show all changes, outlining conflicts:
`diff3 --show-all {{path/to/file1}} {{path/to/file2}} {{path/to/file3}}`"
What is gpasswd command,,"# gpasswd
> Administer `/etc/group` and `/etc/gshadow`. More information:
> https://manned.org/gpasswd.
* Define group administrators:
`sudo gpasswd -A {{user1,user2}} {{group}}`
* Set the list of group members:
`sudo gpasswd -M {{user1,user2}} {{group}}`
* Create a password for the named group:
`gpasswd {{group}}`
* Add a user to the named group:
`gpasswd -a {{user}} {{group}}`
* Remove a user from the named group:
`gpasswd -d {{user}} {{group}}`"
What is htop command,,"# htop
> Display dynamic real-time information about running processes. An enhanced
> version of `top`. More information: https://htop.dev/.
* Start `htop`:
`htop`
* Start `htop` displaying processes owned by a specific user:
`htop --user {{username}}`
* Sort processes by a specified `sort_item` (use `htop --sort help` for available options):
`htop --sort {{sort_item}}`
* See interactive commands while running htop:
`?`
* Switch to a different tab:
`tab`
* Display help:
`htop --help`"
What is git-show command,,"# git show
> Show various types of Git objects (commits, tags, etc.). More information:
> https://git-scm.com/docs/git-show.
* Show information about the latest commit (hash, message, changes, and other metadata):
`git show`
* Show information about a given commit:
`git show {{commit}}`
* Show information about the commit associated with a given tag:
`git show {{tag}}`
* Show information about the 3rd commit from the HEAD of a branch:
`git show {{branch}}~{{3}}`
* Show a commit's message in a single line, suppressing the diff output:
`git show --oneline -s {{commit}}`
* Show only statistics (added/removed characters) about the changed files:
`git show --stat {{commit}}`
* Show only the list of added, renamed or deleted files:
`git show --summary {{commit}}`
* Show the contents of a file as it was at a given revision (e.g. branch, tag or commit):
`git show {{revision}}:{{path/to/file}}`"
What is tar command,,"# tar
> Archiving utility. Often combined with a compression method, such as gzip or
> bzip2. More information: https://www.gnu.org/software/tar.
* [c]reate an archive and write it to a [f]ile:
`tar cf {{path/to/target.tar}} {{path/to/file1 path/to/file2 ...}}`
* [c]reate a g[z]ipped archive and write it to a [f]ile:
`tar czf {{path/to/target.tar.gz}} {{path/to/file1 path/to/file2 ...}}`
* [c]reate a g[z]ipped archive from a directory using relative paths:
`tar czf {{path/to/target.tar.gz}} --directory={{path/to/directory}} .`
* E[x]tract a (compressed) archive [f]ile into the current directory [v]erbosely:
`tar xvf {{path/to/source.tar[.gz|.bz2|.xz]}}`
* E[x]tract a (compressed) archive [f]ile into the target directory:
`tar xf {{path/to/source.tar[.gz|.bz2|.xz]}}
--directory={{path/to/directory}}`
* [c]reate a compressed archive and write it to a [f]ile, using [a]rchive suffix to determine the compression program:
`tar caf {{path/to/target.tar.xz}} {{path/to/file1 path/to/file2 ...}}`
* Lis[t] the contents of a tar [f]ile [v]erbosely:
`tar tvf {{path/to/source.tar}}`
* E[x]tract files matching a pattern from an archive [f]ile:
`tar xf {{path/to/source.tar}} --wildcards ""{{*.html}}""`"
What is pr command,,"# pr
> Paginate or columnate files for printing. More information:
> https://www.gnu.org/software/coreutils/pr.
* Print multiple files with a default header and footer:
`pr {{file1}} {{file2}} {{file3}}`
* Print with a custom centered header:
`pr -h ""{{header}}"" {{file1}} {{file2}} {{file3}}`
* Print with numbered lines and a custom date format:
`pr -n -D ""{{format}}"" {{file1}} {{file2}} {{file3}}`
* Print all files together, one in each column, without a header or footer:
`pr -m -T {{file1}} {{file2}} {{file3}}`
* Print, beginning at page 2 up to page 5, with a given page length (including header and footer):
`pr +{{2}}:{{5}} -l {{page_length}} {{file1}} {{file2}} {{file3}}`
* Print with an offset for each line and a truncating custom page width:
`pr -o {{offset}} -W {{width}} {{file1}} {{file2}} {{file3}}`"
What is git-restore command,,"# git restore
> Restore working tree files. Requires Git version 2.23+. See also `git
> checkout` and `git reset`. More information: https://git-scm.com/docs/git-
> restore.
* Restore an unstaged file to the version of the current commit (HEAD):
`git restore {{path/to/file}}`
* Restore an unstaged file to the version of a specific commit:
`git restore --source {{commit}} {{path/to/file}}`
* Discard all unstaged changes to tracked files:
`git restore :/`
* Unstage a file:
`git restore --staged {{path/to/file}}`
* Unstage all files:
`git restore --staged :/`
* Discard all changes to files, both staged and unstaged:
`git restore --worktree --staged :/`
* Interactively select sections of files to restore:
`git restore --patch`"
What is git-archive command,,"# git archive
> Create an archive of files from a named tree. More information: https://git-
> scm.com/docs/git-archive.
* Create a tar archive from the contents of the current HEAD and print it to `stdout`:
`git archive --verbose HEAD`
* Create a zip archive from the current HEAD and print it to `stdout`:
`git archive --verbose --format=zip HEAD`
* Same as above, but write the zip archive to file:
`git archive --verbose --output={{path/to/file.zip}} HEAD`
* Create a tar archive from the contents of the latest commit on a specific branch:
`git archive --output={{path/to/file.tar}} {{branch_name}}`
* Create a tar archive from the contents of a specific directory:
`git archive --output={{path/to/file.tar}} HEAD:{{path/to/directory}}`
* Prepend a path to each file to archive it inside a specific directory:
`git archive --output={{path/to/file.tar}} --prefix={{path/to/prepend}}/ HEAD`"
What is uname command,,"# uname
> Print details about the current machine and the operating system running on
> it. Note: for additional information about the operating system, try the
> `sw_vers` command. More information: https://ss64.com/osx/uname.html.
* Print kernel name:
`uname`
* Print system architecture and processor information:
`uname -mp`
* Print kernel name, kernel release and kernel version:
`uname -srv`
* Print system hostname:
`uname -n`
* Print all available system information:
`uname -a`"
What is tee command,,"# tee
> Read from `stdin` and write to `stdout` and files (or commands). More
> information: https://www.gnu.org/software/coreutils/tee.
* Copy `stdin` to each file, and also to `stdout`:
`echo ""example"" | tee {{path/to/file}}`
* Append to the given files, do not overwrite:
`echo ""example"" | tee -a {{path/to/file}}`
* Print `stdin` to the terminal, and also pipe it into another program for further processing:
`echo ""example"" | tee {{/dev/tty}} | {{xargs printf ""[%s]""}}`
* Create a directory called ""example"", count the number of characters in ""example"" and write ""example"" to the terminal:
`echo ""example"" | tee >(xargs mkdir) >(wc -c)`"
What is join command,,"# join
> Join lines of two sorted files on a common field. More information:
> https://www.gnu.org/software/coreutils/join.
* Join two files on the first (default) field:
`join {{file1}} {{file2}}`
* Join two files using a comma (instead of a space) as the field separator:
`join -t {{','}} {{file1}} {{file2}}`
* Join field3 of file1 with field1 of file2:
`join -1 {{3}} -2 {{1}} {{file1}} {{file2}}`
* Produce a line for each unpairable line for file1:
`join -a {{1}} {{file1}} {{file2}}`
* Join a file from `stdin`:
`cat {{path/to/file1}} | join - {{path/to/file2}}`"
What is pidof command,,"# pidof
> Gets the ID of a process using its name. More information:
> https://manned.org/pidof.
* List all process IDs with given name:
`pidof {{bash}}`
* List a single process ID with given name:
`pidof -s {{bash}}`
* List process IDs including scripts with given name:
`pidof -x {{script.py}}`
* Kill all processes with given name:
`kill $(pidof {{name}})`"
What is wait command,,"# wait
> Wait for a process to complete before proceeding. More information:
> https://manned.org/wait.
* Wait for a process to finish given its process ID (PID) and return its exit status:
`wait {{pid}}`
* Wait for all processes known to the invoking shell to finish:
`wait`"
What is git-difftool command,,"# git difftool
> Show file changes using external diff tools. Accepts the same options and
> arguments as `git diff`. See also: `git diff`. More information:
> https://git-scm.com/docs/git-difftool.
* List available diff tools:
`git difftool --tool-help`
* Set the default diff tool to meld:
`git config --global diff.tool ""{{meld}}""`
* Use the default diff tool to show staged changes:
`git difftool --staged`
* Use a specific tool (opendiff) to show changes since a given commit:
`git difftool --tool={{opendiff}} {{commit}}`"
What is wc command,,"# wc
> Count lines, words, or bytes. More information:
> https://ss64.com/osx/wc.html.
* Count lines in file:
`wc -l {{path/to/file}}`
* Count words in file:
`wc -w {{path/to/file}}`
* Count characters (bytes) in file:
`wc -c {{path/to/file}}`
* Count characters in file (taking multi-byte character sets into account):
`wc -m {{path/to/file}}`
* Use `stdin` to count lines, words and characters (bytes) in that order:
`{{find .}} | wc`"
What is passwd command,,"# passwd
> Passwd is a tool used to change a user's password. More information:
> https://manned.org/passwd.
* Change the password of the current user interactively:
`passwd`
* Change the password of a specific user:
`passwd {{username}}`
* Get the current status of the user:
`passwd -S`
* Make the password of the account blank (it will set the named account passwordless):
`passwd -d`"
What is command command,,"# command
> Command forces the shell to execute the program and ignore any functions,
> builtins and aliases with the same name. More information:
> https://manned.org/command.
* Execute the `ls` program literally, even if an `ls` alias exists:
`command {{ls}}`
* Display the path to the executable or the alias definition of a specific command:
`command -v {{command_name}}`"
What is getent command,,"# getent
> Get entries from Name Service Switch libraries. More information:
> https://manned.org/getent.
* Get list of all groups:
`getent group`
* See the members of a group:
`getent group {{group_name}}`
* Get list of all services:
`getent services`
* Find a username by UID:
`getent passwd 1000`
* Perform a reverse DNS lookup:
`getent hosts {{host}}`"
What is dd command,,"# dd
> Convert and copy a file. More information: https://keith.github.io/xcode-
> man-pages/dd.1.html.
* Make a bootable USB drive from an isohybrid file (such like `archlinux-xxx.iso`) and show the progress:
`dd if={{path/to/file.iso}} of={{/dev/usb_device}} status=progress`
* Clone a drive to another drive with 4 MB block, ignore error and show the progress:
`dd if={{/dev/source_device}} of={{/dev/dest_device}} bs={{4m}}
conv={{noerror}} status=progress`
* Generate a file of 100 random bytes by using kernel random driver:
`dd if=/dev/urandom of={{path/to/random_file}} bs={{100}} count={{1}}`
* Benchmark the write performance of a disk:
`dd if=/dev/zero of={{path/to/1GB_file}} bs={{1024}} count={{1000000}}`
* Generate a system backup into an IMG file and show the progress:
`dd if=/dev/{{drive_device}} of={{path/to/file.img}} status=progress`
* Restore a drive from an IMG file and show the progress:
`dd if={{path/to/file.img}} of={{/dev/drive_device}} status=progress`
* Check the progress of an ongoing dd operation (run this command from another shell):
`kill -USR1 $(pgrep ^dd)`"
What is join command,,"# join
> Join lines of two sorted files on a common field. More information:
> https://www.gnu.org/software/coreutils/join.
* Join two files on the first (default) field:
`join {{file1}} {{file2}}`
* Join two files using a comma (instead of a space) as the field separator:
`join -t {{','}} {{file1}} {{file2}}`
* Join field3 of file1 with field1 of file2:
`join -1 {{3}} -2 {{1}} {{file1}} {{file2}}`
* Produce a line for each unpairable line for file1:
`join -a {{1}} {{file1}} {{file2}}`
* Join a file from `stdin`:
`cat {{path/to/file1}} | join - {{path/to/file2}}`"
What is bg command,,"# bg
> Resumes jobs that have been suspended (e.g. using `Ctrl + Z`), and keeps
> them running in the background. More information: https://manned.org/bg.
* Resume the most recently suspended job and run it in the background:
`bg`
* Resume a specific job (use `jobs -l` to get its ID) and run it in the background:
`bg %{{job_id}}`"
What is git-var command,,"# git var
> Prints a Git logical variable's value. See `git config`, which is preferred
> over `git var`. More information: https://git-scm.com/docs/git-var.
* Print the value of a Git logical variable:
`git var {{GIT_AUTHOR_IDENT|GIT_COMMITTER_IDENT|GIT_EDITOR|GIT_PAGER}}`
* [l]ist all Git logical variables:
`git var -l`"
What is make command,,"# make
> Task runner for targets described in Makefile. Mostly used to control the
> compilation of an executable from source code. More information:
> https://www.gnu.org/software/make/manual/make.html.
* Call the first target specified in the Makefile (usually named ""all""):
`make`
* Call a specific target:
`make {{target}}`
* Call a specific target, executing 4 jobs at a time in parallel:
`make -j{{4}} {{target}}`
* Use a specific Makefile:
`make --file {{path/to/file}}`
* Execute make from another directory:
`make --directory {{path/to/directory}}`
* Force making of a target, even if source files are unchanged:
`make --always-make {{target}}`
* Override a variable defined in the Makefile:
`make {{target}} {{variable}}={{new_value}}`
* Override variables defined in the Makefile by the environment:
`make --environment-overrides {{target}}`"
What is uudecode command,,"# uudecode
> Decode files encoded by `uuencode`. More information:
> https://manned.org/uudecode.
* Decode a file that was encoded with `uuencode` and print the result to `stdout`:
`uudecode {{path/to/encoded_file}}`
* Decode a file that was encoded with `uuencode` and write the result to a file:
`uudecode -o {{path/to/decoded_file}} {{path/to/encoded_file}}`"
What is diff command,,"# diff
> Compare files and directories. More information: https://man7.org/linux/man-
> pages/man1/diff.1.html.
* Compare files (lists changes to turn `old_file` into `new_file`):
`diff {{old_file}} {{new_file}}`
* Compare files, ignoring white spaces:
`diff --ignore-all-space {{old_file}} {{new_file}}`
* Compare files, showing the differences side by side:
`diff --side-by-side {{old_file}} {{new_file}}`
* Compare files, showing the differences in unified format (as used by `git diff`):
`diff --unified {{old_file}} {{new_file}}`
* Compare directories recursively (shows names for differing files/directories as well as changes made to files):
`diff --recursive {{old_directory}} {{new_directory}}`
* Compare directories, only showing the names of files that differ:
`diff --recursive --brief {{old_directory}} {{new_directory}}`
* Create a patch file for Git from the differences of two text files, treating nonexistent files as empty:
`diff --text --unified --new-file {{old_file}} {{new_file}} > {{diff.patch}}`"
What is ln command,,"# ln
> Creates links to files and directories. More information:
> https://www.gnu.org/software/coreutils/ln.
* Create a symbolic link to a file or directory:
`ln -s {{/path/to/file_or_directory}} {{path/to/symlink}}`
* Overwrite an existing symbolic link to point to a different file:
`ln -sf {{/path/to/new_file}} {{path/to/symlink}}`
* Create a hard link to a file:
`ln {{/path/to/file}} {{path/to/hardlink}}`"
What is cal command,,"# cal
> Prints calendar information. More information:
> https://ss64.com/osx/cal.html.
* Display a calendar for the current month:
`cal`
* Display previous, current and next month:
`cal -3`
* Display a calendar for a specific month (1-12 or name):
`cal -m {{month}}`
* Display a calendar for the current year:
`cal -y`
* Display a calendar for a specific year (4 digits):
`cal {{year}}`
* Display a calendar for a specific month and year:
`cal {{month}} {{year}}`
* Display date of Easter (Western Christian churches) in a given year:
`ncal -e {{year}}`"
What is file command,,"# file
> Determine file type. More information: https://manned.org/file.
* Give a description of the type of the specified file. Works fine for files with no file extension:
`file {{path/to/file}}`
* Look inside a zipped file and determine the file type(s) inside:
`file -z {{foo.zip}}`
* Allow file to work with special or device files:
`file -s {{path/to/file}}`
* Don't stop at first file type match; keep going until the end of the file:
`file -k {{path/to/file}}`
* Determine the MIME encoding type of a file:
`file -i {{path/to/file}}`"
What is vi command,,"# vi
> This command is an alias of `vim`.
* View documentation for the original command:
`tldr vim`"
What is pwdx command,,"# pwdx
> Print working directory of a process. More information:
> https://manned.org/pwdx.
* Print current working directory of a process:
`pwdx {{process_id}}`"
What is locate command,,"# locate
> Find filenames quickly. More information: https://manned.org/locate.
* Look for pattern in the database. Note: the database is recomputed periodically (usually weekly or daily):
`locate ""{{pattern}}""`
* Look for a file by its exact filename (a pattern containing no globbing characters is interpreted as `*pattern*`):
`locate */{{filename}}`
* Recompute the database. You need to do it if you want to find recently added files:
`sudo /usr/libexec/locate.updatedb`"
What is rm command,,"# rm
> Remove files or directories. See also: `rmdir`. More information:
> https://www.gnu.org/software/coreutils/rm.
* Remove specific files:
`rm {{path/to/file1 path/to/file2 ...}}`
* Remove specific files ignoring nonexistent ones:
`rm -f {{path/to/file1 path/to/file2 ...}}`
* Remove specific files [i]nteractively prompting before each removal:
`rm -i {{path/to/file1 path/to/file2 ...}}`
* Remove specific files printing info about each removal:
`rm -v {{path/to/file1 path/to/file2 ...}}`
* Remove specific files and directories [r]ecursively:
`rm -r {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`"
What is ldapsearch command,,"# ldapsearch
> Query an LDAP directory. More information: https://docs.ldap.com/ldap-
> sdk/docs/tool-usages/ldapsearch.html.
* Query an LDAP server for all items that are a member of the given group and return the object's displayName value:
`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}} -b
{{base_ou}} '{{memberOf=group1}}' displayName`
* Query an LDAP server with a no-newline password file for all items that are a member of the given group and return the object's displayName value:
`ldapsearch -D '{{admin_DN}}' -y '{{password_file}}' -h {{ldap_host}} -b
{{base_ou}} '{{memberOf=group1}}' displayName`
* Return 5 items that match the given filter:
`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}} -b
{{base_ou}} '{{memberOf=group1}}' -z 5 displayName`
* Wait up to 7 seconds for a response:
`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}} -b
{{base_ou}} '{{memberOf=group1}}' -l 7 displayName`
* Invert the filter:
`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}} -b
{{base_ou}} '(!(memberOf={{group1}}))' displayName`
* Return all items that are part of multiple groups, returning the display name for each item:
`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}}
'(&({{memberOf=group1}})({{memberOf=group2}})({{memberOf=group3}}))'
""displayName""`
* Return all items that are members of at least 1 of the specified groups:
`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}}
'(|({{memberOf=group1}})({{memberOf=group1}})({{memberOf=group3}}))'
displayName`
* Combine multiple boolean logic filters:
`ldapsearch -D '{{admin_DN}}' -w '{{password}}' -h {{ldap_host}}
'(&({{memberOf=group1}})({{memberOf=group2}})(!({{memberOf=group3}})))'
displayName`"
What is git-clean command,,"# git clean
> Remove untracked files from the working tree. More information: https://git-
> scm.com/docs/git-clean.
* Delete files that are not tracked by Git:
`git clean`
* Interactively delete files that are not tracked by Git:
`git clean -i`
* Show what files would be deleted without actually deleting them:
`git clean --dry-run`
* Forcefully delete files that are not tracked by Git:
`git clean -f`
* Forcefully delete directories that are not tracked by Git:
`git clean -fd`
* Delete untracked files, including ignored files in `.gitignore` and `.git/info/exclude`:
`git clean -x`"
What is git-bugreport command,,"# git bugreport
> Captures debug information from the system and user, generating a text file
> to aid in the reporting of a bug in Git. More information: https://git-
> scm.com/docs/git-bugreport.
* Create a new bug report file in the current directory:
`git bugreport`
* Create a new bug report file in the specified directory, creating it if it does not exist:
`git bugreport --output-directory {{path/to/directory}}`
* Create a new bug report file with the specified filename suffix in `strftime` format:
`git bugreport --suffix {{%m%d%y}}`"
What is keyctl command,,"# keyctl
> Manipulate the Linux kernel keyring. More information:
> https://manned.org/keyctl.
* List keys in a specific keyring:
`keyctl list {{target_keyring}}`
* List current keys in the user default session:
`keyctl list {{@us}}`
* Store a key in a specific keyring:
`keyctl add {{type_keyring}} {{key_name}} {{key_value}} {{target_keyring}}`
* Store a key with its value from `stdin`:
`echo -n {{key_value}} | keyctl padd {{type_keyring}} {{key_name}}
{{target_keyring}}`
* Put a timeout on a key:
`keyctl timeout {{key_name}} {{timeout_in_seconds}}`
* Read a key and format it as a hex-dump if not printable:
`keyctl read {{key_name}}`
* Read a key and format as-is:
`keyctl pipe {{key_name}}`
* Revoke a key and prevent any further action on it:
`keyctl revoke {{key_name}}`"
What is dpkg-query command,,"# dpkg-query
> A tool that shows information about installed packages. More information:
> https://manpages.debian.org/latest/dpkg/dpkg-query.1.html.
* List all installed packages:
`dpkg-query --list`
* List installed packages matching a pattern:
`dpkg-query --list '{{libc6*}}'`
* List all files installed by a package:
`dpkg-query --listfiles {{libc6}}`
* Show information about a package:
`dpkg-query --status {{libc6}}`
* Search for packages that own files matching a pattern:
`dpkg-query --search {{/etc/ld.so.conf.d}}`"
What is git-blame command,,"# git blame
> Show commit hash and last author on each line of a file. More information:
> https://git-scm.com/docs/git-blame.
* Print file with author name and commit hash on each line:
`git blame {{path/to/file}}`
* Print file with author email and commit hash on each line:
`git blame -e {{path/to/file}}`
* Print file with author name and commit hash on each line at a specific commit:
`git blame {{commit}} {{path/to/file}}`
* Print file with author name and commit hash on each line before a specific commit:
`git blame {{commit}}~ {{path/to/file}}`"
What is login command,,"# login
> Initiates a session for a user. More information: https://manned.org/login.
* Log in as a user:
`login {{user}}`
* Log in as user without authentication if user is preauthenticated:
`login -f {{user}}`
* Log in as user and preserve environment:
`login -p {{user}}`
* Log in as a user on a remote host:
`login -h {{host}} {{user}}`"
What is git-show-index command,,"# git show-index
> Show the packed archive index of a Git repository. More information:
> https://git-scm.com/docs/git-show-index.
* Read an IDX file for a Git packfile and dump its contents to `stdout`:
`git show-index {{path/to/file.idx}}`
* Specify the hash algorithm for the index file (experimental):
`git show-index --object-format={{sha1|sha256}} {{path/to/file}}`"
What is crontab command,,"# crontab
> Schedule cron jobs to run on a time interval for the current user. More
> information: https://crontab.guru/.
* Edit the crontab file for the current user:
`crontab -e`
* Edit the crontab file for a specific user:
`sudo crontab -e -u {{user}}`
* Replace the current crontab with the contents of the given file:
`crontab {{path/to/file}}`
* View a list of existing cron jobs for current user:
`crontab -l`
* Remove all cron jobs for the current user:
`crontab -r`
* Sample job which runs at 10:00 every day (* means any value):
`0 10 * * * {{command_to_execute}}`
* Sample crontab entry, which runs a command every 10 minutes:
`*/10 * * * * {{command_to_execute}}`
* Sample crontab entry, which runs a certain script at 02:30 every Friday:
`30 2 * * Fri {{/absolute/path/to/script.sh}}`"
What is install command,,"# install
> Copy files and set attributes. Copy files (often executable) to a system
> location like `/usr/local/bin`, give them the appropriate
> permissions/ownership. More information:
> https://www.gnu.org/software/coreutils/install.
* Copy files to the destination:
`install {{path/to/source_file1 path/to/source_file2 ...}}
{{path/to/destination}}`
* Copy files to the destination, setting their ownership:
`install --owner {{user}} {{path/to/source_file1 path/to/source_file2 ...}}
{{path/to/destination}}`
* Copy files to the destination, setting their group ownership:
`install --group {{user}} {{path/to/source_file1 path/to/source_file2 ...}}
{{path/to/destination}}`
* Copy files to the destination, setting their `mode`:
`install --mode {{+x}} {{path/to/source_file1 path/to/source_file2 ...}}
{{path/to/destination}}`
* Copy files and apply access/modification times of source to the destination:
`install --preserve-timestamps {{path/to/source_file1 path/to/source_file2
...}} {{path/to/destination}}`
* Copy files and create the directories at the destination if they don't exist:
`install -D {{path/to/source_file1 path/to/source_file2 ...}}
{{path/to/destination}}`"
What is colrm command,,"# colrm
> Remove columns from `stdin`. More information: https://manned.org/colrm.
* Remove first column of `stdin`:
`colrm {{1 1}}`
* Remove from 3rd column till the end of each line:
`colrm {{3}}`
* Remove from the 3rd column till the 5th column of each line:
`colrm {{3 5}}`"
What is resolvectl command,,"# resolvectl
> Resolve domain names, IPv4 and IPv6 addresses, DNS resource records, and
> services. Introspect and reconfigure the DNS resolver. More information:
> https://www.freedesktop.org/software/systemd/man/resolvectl.html.
* Show DNS settings:
`resolvectl status`
* Resolve the IPv4 and IPv6 addresses for one or more domains:
`resolvectl query {{domain1 domain2 ...}}`
* Retrieve the domain of a specified IP address:
`resolvectl query {{ip_address}}`
* Retrieve an MX record of a domain:
`resolvectl --legend={{no}} --type={{MX}} query {{domain}}`
* Resolve an SRV record, for example _xmpp-server._tcp gmail.com:
`resolvectl service _{{service}}._{{protocol}} {{name}}`
* Retrieve the public key from an email address from an OPENPGPKEY DNS record:
`resolvectl openpgp {{email}}`
* Retrieve a TLS key:
`resolvectl tlsa tcp {{domain}}:443`"
What is ssh-keygen command,,"# ssh-keygen
> Generate ssh keys used for authentication, password-less logins, and other
> things. More information: https://man.openbsd.org/ssh-keygen.
* Generate a key interactively:
`ssh-keygen`
* Generate an ed25519 key with 32 key derivation function rounds and save the key to a specific file:
`ssh-keygen -t {{ed25519}} -a {{32}} -f {{~/.ssh/filename}}`
* Generate an RSA 4096-bit key with email as a comment:
`ssh-keygen -t {{rsa}} -b {{4096}} -C ""{{comment|email}}""`
* Remove the keys of a host from the known_hosts file (useful when a known host has a new key):
`ssh-keygen -R {{remote_host}}`
* Retrieve the fingerprint of a key in MD5 Hex:
`ssh-keygen -l -E {{md5}} -f {{~/.ssh/filename}}`
* Change the password of a key:
`ssh-keygen -p -f {{~/.ssh/filename}}`
* Change the type of the key format (for example from OPENSSH format to PEM), the file will be rewritten in-place:
`ssh-keygen -p -N """" -m {{PEM}} -f {{~/.ssh/OpenSSH_private_key}}`
* Retrieve public key from secret key:
`ssh-keygen -y -f {{~/.ssh/OpenSSH_private_key}}`"
What is pidstat command,,"# pidstat
> Show system resource usage, including CPU, memory, IO etc. More information:
> https://manned.org/pidstat.
* Show CPU statistics at a 2 second interval for 10 times:
`pidstat {{2}} {{10}}`
* Show page faults and memory utilization:
`pidstat -r`
* Show input/output usage per process id:
`pidstat -d`
* Show information on a specific PID:
`pidstat -p {{PID}}`
* Show memory statistics for all processes whose command name include ""fox"" or ""bird"":
`pidstat -C ""{{fox|bird}}"" -r -p ALL`"
What is git-stash command,,"# git stash
> Stash local Git changes in a temporary area. More information: https://git-
> scm.com/docs/git-stash.
* Stash current changes, except new (untracked) files:
`git stash push -m {{optional_stash_message}}`
* Stash current changes, including new (untracked) files:
`git stash -u`
* Interactively select parts of changed files for stashing:
`git stash -p`
* List all stashes (shows stash name, related branch and message):
`git stash list`
* Show the changes as a patch between the stash (default is stash@{0}) and the commit back when stash entry was first created:
`git stash show -p {{stash@{0}}}`
* Apply a stash (default is the latest, named stash@{0}):
`git stash apply {{optional_stash_name_or_commit}}`
* Drop or apply a stash (default is stash@{0}) and remove it from the stash list if applying doesn't cause conflicts:
`git stash pop {{optional_stash_name}}`
* Drop all stashes:
`git stash clear`"
What is git-bisect command,,"# git bisect
> Use binary search to find the commit that introduced a bug. Git
> automatically jumps back and forth in the commit graph to progressively
> narrow down the faulty commit. More information: https://git-
> scm.com/docs/git-bisect.
* Start a bisect session on a commit range bounded by a known buggy commit, and a known clean (typically older) one:
`git bisect start {{bad_commit}} {{good_commit}}`
* For each commit that `git bisect` selects, mark it as ""bad"" or ""good"" after testing it for the issue:
`git bisect {{good|bad}}`
* After `git bisect` pinpoints the faulty commit, end the bisect session and return to the previous branch:
`git bisect reset`
* Skip a commit during a bisect (e.g. one that fails the tests due to a different issue):
`git bisect skip`
* Display a log of what has been done so far:
`git bisect log`"
What is systemd-ac-power command,,"# systemd-ac-power
> Report whether the computer is connected to an external power source. More
> information: https://www.freedesktop.org/software/systemd/man/systemd-ac-
> power.html.
* Silently check and return a 0 status code when running on AC power, and a non-zero code otherwise:
`systemd-ac-power`
* Additionally print `yes` or `no` to `stdout`:
`systemd-ac-power --verbose`"
What is getopt command,,"# getopt
> Parse command-line arguments. More information:
> https://www.gnu.org/software/libc/manual/html_node/Getopt.html.
* Parse optional `verbose`/`version` flags with shorthands:
`getopt --options vV --longoptions verbose,version -- --version --verbose`
* Add a `--file` option with a required argument with shorthand `-f`:
`getopt --options f: --longoptions file: -- --file=somefile`
* Add a `--verbose` option with an optional argument with shorthand `-v`, and pass a non-option parameter `arg`:
`getopt --options v:: --longoptions verbose:: -- --verbose arg`
* Accept a `-r` and `--verbose` flag, a `--accept` option with an optional argument and add a `--target` with a required argument option with shorthands:
`getopt --options rv::s::t: --longoptions verbose,source::,target: -- -v
--target target`"
What is pkill command,,"# pkill
> Signal process by name. Mostly used for stopping processes. More
> information: https://www.man7.org/linux/man-pages/man1/pkill.1.html.
* Kill all processes which match:
`pkill ""{{process_name}}""`
* Kill all processes which match their full command instead of just the process name:
`pkill -f ""{{command_name}}""`
* Force kill matching processes (can't be blocked):
`pkill -9 ""{{process_name}}""`
* Send SIGUSR1 signal to processes which match:
`pkill -USR1 ""{{process_name}}""`
* Kill the main `firefox` process to close the browser:
`pkill --oldest ""{{firefox}}""`"
What is ssh-keyscan command,,"# ssh-keyscan
> Get the public ssh keys of remote hosts. More information:
> https://man.openbsd.org/ssh-keyscan.
* Retrieve all public ssh keys of a remote host:
`ssh-keyscan {{host}}`
* Retrieve all public ssh keys of a remote host listening on a specific port:
`ssh-keyscan -p {{port}} {{host}}`
* Retrieve certain types of public ssh keys of a remote host:
`ssh-keyscan -t {{rsa,dsa,ecdsa,ed25519}} {{host}}`
* Manually update the ssh known_hosts file with the fingerprint of a given host:
`ssh-keyscan -H {{host}} >> ~/.ssh/known_hosts`"
What is test command,,"# test
> Check file types and compare values. Returns 0 if the condition evaluates to
> true, 1 if it evaluates to false. More information:
> https://www.gnu.org/software/coreutils/test.
* Test if a given variable is equal to a given string:
`test ""{{$MY_VAR}}"" == ""{{/bin/zsh}}""`
* Test if a given variable is empty:
`test -z ""{{$GIT_BRANCH}}""`
* Test if a file exists:
`test -f ""{{path/to/file_or_directory}}""`
* Test if a directory does not exist:
`test ! -d ""{{path/to/directory}}""`
* If A is true, then do B, or C in the case of an error (notice that C may run even if A fails):
`test {{condition}} && {{echo ""true""}} || {{echo ""false""}}`"
What is systemd-notify command,,"# systemd-notify
> Notify the service manager about start-up completion and other daemon status
> changes. This command is useless outside systemd service scripts. More
> information: https://www.freedesktop.org/software/systemd/man/systemd-
> notify.html.
* Notify systemd that the service has completed its initialization and is fully started. It should be invoked when the service is ready to accept incoming requests:
`systemd-notify --booted`
* Signal to systemd that the service is ready to handle incoming connections or perform its tasks:
`systemd-notify --ready`
* Provide a custom status message to systemd (this information is shown by `systemctl status`):
`systemd-notify --status=""{{Add custom status message here...}}""`"
What is pr command,,"# pr
> Paginate or columnate files for printing. More information:
> https://www.gnu.org/software/coreutils/pr.
* Print multiple files with a default header and footer:
`pr {{file1}} {{file2}} {{file3}}`
* Print with a custom centered header:
`pr -h ""{{header}}"" {{file1}} {{file2}} {{file3}}`
* Print with numbered lines and a custom date format:
`pr -n -D ""{{format}}"" {{file1}} {{file2}} {{file3}}`
* Print all files together, one in each column, without a header or footer:
`pr -m -T {{file1}} {{file2}} {{file3}}`
* Print, beginning at page 2 up to page 5, with a given page length (including header and footer):
`pr +{{2}}:{{5}} -l {{page_length}} {{file1}} {{file2}} {{file3}}`
* Print with an offset for each line and a truncating custom page width:
`pr -o {{offset}} -W {{width}} {{file1}} {{file2}} {{file3}}`"
What is git-symbolic-ref command,,"# git symbolic-ref
> Read, change, or delete files that store references. More information:
> https://git-scm.com/docs/git-symbolic-ref.
* Store a reference by a name:
`git symbolic-ref refs/{{name}} {{ref}}`
* Store a reference by name, including a message with a reason for the update:
`git symbolic-ref -m ""{{message}}"" refs/{{name}} refs/heads/{{branch_name}}`
* Read a reference by name:
`git symbolic-ref refs/{{name}}`
* Delete a reference by name:
`git symbolic-ref --delete refs/{{name}}`
* For scripting, hide errors with `--quiet` and use `--short` to simplify (""refs/heads/X"" prints as ""X""):
`git symbolic-ref --quiet --short refs/{{name}}`"
What is tty command,,"# tty
> Returns terminal name. More information:
> https://www.gnu.org/software/coreutils/tty.
* Print the file name of this terminal:
`tty`"
What is git-instaweb command,,"# git instaweb
> Helper to launch a GitWeb server. More information: https://git-
> scm.com/docs/git-instaweb.
* Launch a GitWeb server for the current Git repository:
`git instaweb --start`
* Listen only on localhost:
`git instaweb --start --local`
* Listen on a specific port:
`git instaweb --start --port {{1234}}`
* Use a specified HTTP daemon:
`git instaweb --start --httpd {{lighttpd|apache2|mongoose|plackup|webrick}}`
* Also auto-launch a web browser:
`git instaweb --start --browser`
* Stop the currently running GitWeb server:
`git instaweb --stop`
* Restart the currently running GitWeb server:
`git instaweb --restart`"
What is newgrp command,,"# newgrp
> Switch primary group membership. More information:
> https://manned.org/newgrp.
* Change user's primary group membership:
`newgrp {{group_name}}`
* Reset primary group membership to user's default group in `/etc/passwd`:
`newgrp`"
What is dircolors command,,"# dircolors
> Output commands to set the LS_COLOR environment variable and style `ls`,
> `dir`, etc. More information:
> https://www.gnu.org/software/coreutils/dircolors.
* Output commands to set LS_COLOR using default colors:
`dircolors`
* Output commands to set LS_COLOR using colors from a file:
`dircolors {{path/to/file}}`
* Output commands for Bourne shell:
`dircolors --bourne-shell`
* Output commands for C shell:
`dircolors --c-shell`
* View the default colors for file types and extensions:
`dircolors --print-data`"
What is utmpdump command,,"# utmpdump
> Dump and load btmp, utmp and wtmp accounting files. More information:
> https://manned.org/utmpdump.
* Dump the `/var/log/wtmp` file to `stdout` as plain text:
`utmpdump {{/var/log/wtmp}}`
* Load a previously dumped file into `/var/log/wtmp`:
`utmpdump -r {{dumpfile}} > {{/var/log/wtmp}}`"
What is lp command,,"# lp
> Print files. More information: https://manned.org/lp.
* Print the output of a command to the default printer (see `lpstat` command):
`echo ""test"" | lp`
* Print a file to the default printer:
`lp {{path/to/filename}}`
* Print a file to a named printer (see `lpstat` command):
`lp -d {{printer_name}} {{path/to/filename}}`
* Print N copies of file to default printer (replace N with desired number of copies):
`lp -n {{N}} {{path/to/filename}}`
* Print only certain pages to the default printer (print pages 1, 3-5, and 16):
`lp -P 1,3-5,16 {{path/to/filename}}`
* Resume printing a job:
`lp -i {{job_id}} -H resume`"
What is git-verify-tag command,,"# git verify-tag
> Check for GPG verification of tags. If a tag wasn't signed, an error will
> occur. More information: https://git-scm.com/docs/git-verify-tag.
* Check tags for a GPG signature:
`git verify-tag {{tag1 optional_tag2 ...}}`
* Check tags for a GPG signature and show details for each tag:
`git verify-tag {{tag1 optional_tag2 ...}} --verbose`
* Check tags for a GPG signature and print the raw details:
`git verify-tag {{tag1 optional_tag2 ...}} --raw`"
What is du command,,"# du
> Disk usage: estimate and summarize file and directory space usage. More
> information: https://ss64.com/osx/du.html.
* List the sizes of a directory and any subdirectories, in the given unit (KiB/MiB/GiB):
`du -{{k|m|g}} {{path/to/directory}}`
* List the sizes of a directory and any subdirectories, in human-readable form (i.e. auto-selecting the appropriate unit for each size):
`du -h {{path/to/directory}}`
* Show the size of a single directory, in human-readable units:
`du -sh {{path/to/directory}}`
* List the human-readable sizes of a directory and of all the files and directories within it:
`du -ah {{path/to/directory}}`
* List the human-readable sizes of a directory and any subdirectories, up to N levels deep:
`du -h -d {{2}} {{path/to/directory}}`
* List the human-readable size of all `.jpg` files in subdirectories of the current directory, and show a cumulative total at the end:
`du -ch {{*/*.jpg}}`"
What is pgrep command,,"# pgrep
> Find or signal processes by name. More information:
> https://www.man7.org/linux/man-pages/man1/pkill.1.html.
* Return PIDs of any running processes with a matching command string:
`pgrep {{process_name}}`
* Search for processes including their command-line options:
`pgrep --full ""{{process_name}} {{parameter}}""`
* Search for processes run by a specific user:
`pgrep --euid root {{process_name}}`"
What is bc command,,"# bc
> An arbitrary precision calculator language. See also: `dc`. More
> information: https://manned.org/man/freebsd-13.0/bc.1.
* Start an interactive session:
`bc`
* Start an interactive session with the standard math library enabled:
`bc --mathlib`
* Calculate an expression:
`bc --expression='{{5 / 3}}'`
* Execute a script:
`bc {{path/to/script.bc}}`
* Calculate an expression with the specified scale:
`bc --expression='scale = {{10}}; {{5 / 3}}'`
* Calculate a sine/cosine/arctangent/natural logarithm/exponential function using `mathlib`:
`bc --mathlib --expression='{{s|c|a|l|e}}({{1}})'`"
What is git-credential-cache command,,"# git credential-cache
> Git helper to temporarily store passwords in memory. More information:
> https://git-scm.com/docs/git-credential-cache.
* Store Git credentials for a specific amount of time:
`git config credential.helper 'cache --timeout={{time_in_seconds}}'`"
What is git-log command,,"# git log
> Show a history of commits. More information: https://git-scm.com/docs/git-
> log.
* Show the sequence of commits starting from the current one, in reverse chronological order of the Git repository in the current working directory:
`git log`
* Show the history of a particular file or directory, including differences:
`git log -p {{path/to/file_or_directory}}`
* Show an overview of which file(s) changed in each commit:
`git log --stat`
* Show a graph of commits in the current branch using only the first line of each commit message:
`git log --oneline --graph`
* Show a graph of all commits, tags and branches in the entire repo:
`git log --oneline --decorate --all --graph`
* Show only commits whose messages include a given string (case-insensitively):
`git log -i --grep {{search_string}}`
* Show the last N commits from a certain author:
`git log -n {{number}} --author={{author}}`
* Show commits between two dates (yyyy-mm-dd):
`git log --before=""{{2017-01-29}}"" --after=""{{2017-01-17}}""`"
What is quota command,,"# quota
> Display users' disk space usage and allocated limits. More information:
> https://manned.org/quota.
* Show disk quotas in human-readable units for the current user:
`quota -s`
* Verbose output (also display quotas on filesystems where no storage is allocated):
`quota -v`
* Quiet output (only display quotas on filesystems where usage is over quota):
`quota -q`
* Print quotas for the groups of which the current user is a member:
`quota -g`
* Show disk quotas for another user:
`sudo quota -u {{username}}`"
What is git-format-patch command,,"# git format-patch
> Prepare .patch files. Useful when emailing commits elsewhere. See also `git
> am`, which can apply generated .patch files. More information: https://git-
> scm.com/docs/git-format-patch.
* Create an auto-named `.patch` file for all the unpushed commits:
`git format-patch {{origin}}`
* Write a `.patch` file for all the commits between 2 revisions to `stdout`:
`git format-patch {{revision_1}}..{{revision_2}}`
* Write a `.patch` file for the 3 latest commits:
`git format-patch -{{3}}`"
What is false command,,"# false
> Returns a non-zero exit code. More information:
> https://www.gnu.org/software/coreutils/false.
* Return a non-zero exit code:
`false`"
What is iconv command,,"# iconv
> Converts text from one encoding to another. More information:
> https://manned.org/iconv.
* Convert file to a specific encoding, and print to `stdout`:
`iconv -f {{from_encoding}} -t {{to_encoding}} {{input_file}}`
* Convert file to the current locale's encoding, and output to a file:
`iconv -f {{from_encoding}} {{input_file}} > {{output_file}}`
* List supported encodings:
`iconv -l`"
What is sync command,,"# sync
> Flushes all pending write operations to the appropriate disks. More
> information: https://www.gnu.org/software/coreutils/sync.
* Flush all pending write operations on all disks:
`sync`
* Flush all pending write operations on a single file to disk:
`sync {{path/to/file}}`"
What is diff command,,"# diff
> Compare files and directories. More information: https://man7.org/linux/man-
> pages/man1/diff.1.html.
* Compare files (lists changes to turn `old_file` into `new_file`):
`diff {{old_file}} {{new_file}}`
* Compare files, ignoring white spaces:
`diff --ignore-all-space {{old_file}} {{new_file}}`
* Compare files, showing the differences side by side:
`diff --side-by-side {{old_file}} {{new_file}}`
* Compare files, showing the differences in unified format (as used by `git diff`):
`diff --unified {{old_file}} {{new_file}}`
* Compare directories recursively (shows names for differing files/directories as well as changes made to files):
`diff --recursive {{old_directory}} {{new_directory}}`
* Compare directories, only showing the names of files that differ:
`diff --recursive --brief {{old_directory}} {{new_directory}}`
* Create a patch file for Git from the differences of two text files, treating nonexistent files as empty:
`diff --text --unified --new-file {{old_file}} {{new_file}} > {{diff.patch}}`"
What is rmdir command,,"# rmdir
> Remove directories without files. See also: `rm`. More information:
> https://www.gnu.org/software/coreutils/rmdir.
* Remove specific directories:
`rmdir {{path/to/directory1 path/to/directory2 ...}}`
* Remove specific nested directories recursively:
`rmdir -p {{path/to/directory1 path/to/directory2 ...}}`"
What is shuf command,,"# shuf
> Generate random permutations. More information: https://www.unix.com/man-
> page/linux/1/shuf/.
* Randomize the order of lines in a file and output the result:
`shuf {{filename}}`
* Only output the first 5 entries of the result:
`shuf --head-count={{5}} {{filename}}`
* Write output to another file:
`shuf {{filename}} --output={{output_filename}}`
* Generate random numbers in range 1-10:
`shuf --input-range={{1-10}}`"
What is git-bundle command,,"# git bundle
> Package objects and references into an archive. More information:
> https://git-scm.com/docs/git-bundle.
* Create a bundle file that contains all objects and references of a specific branch:
`git bundle create {{path/to/file.bundle}} {{branch_name}}`
* Create a bundle file of all branches:
`git bundle create {{path/to/file.bundle}} --all`
* Create a bundle file of the last 5 commits of the current branch:
`git bundle create {{path/to/file.bundle}} -{{5}} {{HEAD}}`
* Create a bundle file of the latest 7 days:
`git bundle create {{path/to/file.bundle}} --since={{7.days}} {{HEAD}}`
* Verify that a bundle file is valid and can be applied to the current repository:
`git bundle verify {{path/to/file.bundle}}`
* Print to `stdout` the list of references contained in a bundle:
`git bundle unbundle {{path/to/file.bundle}}`
* Unbundle a specific branch from a bundle file into the current repository:
`git pull {{path/to/file.bundle}} {{branch_name}}`"
What is link command,,"# link
> Create a hard link to an existing file. For more options, see the `ln`
> command. More information: https://www.gnu.org/software/coreutils/link.
* Create a hard link from a new file to an existing file:
`link {{path/to/existing_file}} {{path/to/new_file}}`"
What is systemd-delta command,,"# systemd-delta
> Find overridden systemd-related configuration files. More information:
> https://www.freedesktop.org/software/systemd/man/systemd-delta.html.
* Show all overridden configuration files:
`systemd-delta`
* Show only files of specific types (comma-separated list):
`systemd-delta --type
{{masked|equivalent|redirected|overridden|extended|unchanged}}`
* Show only files whose path starts with the specified prefix (Note: a prefix is a directory containing subdirectories with systemd configuration files):
`systemd-delta {{/etc|/run|/usr/lib|...}}`
* Further restrict the search path by adding a suffix (the prefix is optional):
`systemd-delta {{prefix}}/{{tmpfiles.d|sysctl.d|systemd/system|...}}`"
What is namei command,,"# namei
> Follows a pathname (which can be a symbolic link) until a terminal point is
> found (a file/directory/char device etc). This program is useful for finding
> ""too many levels of symbolic links"" problems. More information:
> https://manned.org/namei.
* Resolve the pathnames specified as the argument parameters:
`namei {{path/to/a}} {{path/to/b}} {{path/to/c}}`
* Display the results in a long-listing format:
`namei --long {{path/to/a}} {{path/to/b}} {{path/to/c}}`
* Show the mode bits of each file type in the style of `ls`:
`namei --modes {{path/to/a}} {{path/to/b}} {{path/to/c}}`
* Show owner and group name of each file:
`namei --owners {{path/to/a}} {{path/to/b}} {{path/to/c}}`
* Don't follow symlinks while resolving:
`namei --nosymlinks {{path/to/a}} {{path/to/b}} {{path/to/c}}`"
What is lastcomm command,,"# lastcomm
> Show last commands executed. More information:
> https://manpages.debian.org/latest/acct/lastcomm.1.en.html.
* Print information about all the commands in the acct (record file):
`lastcomm`
* Display commands executed by a given user:
`lastcomm --user {{user}}`
* Display information about a given command executed on the system:
`lastcomm --command {{command}}`
* Display information about commands executed on a given terminal:
`lastcomm --tty {{terminal_name}}`"
What is egrep command,,"# egrep
> Find patterns in files using extended regular expression (supports `?`, `+`,
> `{}`, `()` and `|`). More information: https://manned.org/egrep.
* Search for a pattern within a file:
`egrep ""{{search_pattern}}"" {{path/to/file}}`
* Search for a pattern within multiple files:
`egrep ""{{search_pattern}}"" {{path/to/file1}} {{path/to/file2}}
{{path/to/file3}}`
* Search `stdin` for a pattern:
`cat {{path/to/file}} | egrep {{search_pattern}}`
* Print file name and line number for each match:
`egrep --with-filename --line-number ""{{search_pattern}}"" {{path/to/file}}`
* Search for a pattern in all files recursively in a directory, ignoring binary files:
`egrep --recursive --binary-files={{without-match}} ""{{search_pattern}}""
{{path/to/directory}}`
* Search for lines that do not match a pattern:
`egrep --invert-match ""{{search_pattern}}"" {{path/to/file}}`"
What is setfacl command,,"# setfacl
> Set file access control lists (ACL). More information:
> https://manned.org/setfacl.
* Modify ACL of a file for user with read and write access:
`setfacl -m u:{{username}}:rw {{file}}`
* Modify default ACL of a file for all users:
`setfacl -d -m u::rw {{file}}`
* Remove ACL of a file for a user:
`setfacl -x u:{{username}} {{file}}`
* Remove all ACL entries of a file:
`setfacl -b {{file}}`"
What is paste command,,"# paste
> Merge lines of files. More information:
> https://www.gnu.org/software/coreutils/paste.
* Join all the lines into a single line, using TAB as delimiter:
`paste -s {{path/to/file}}`
* Join all the lines into a single line, using the specified delimiter:
`paste -s -d {{delimiter}} {{path/to/file}}`
* Merge two files side by side, each in its column, using TAB as delimiter:
`paste {{file1}} {{file2}}`
* Merge two files side by side, each in its column, using the specified delimiter:
`paste -d {{delimiter}} {{file1}} {{file2}}`
* Merge two files, with lines added alternatively:
`paste -d '\n' {{file1}} {{file2}}`"
What is busctl command,,"# busctl
> Introspect and monitor the D-Bus bus. More information:
> https://www.freedesktop.org/software/systemd/man/busctl.html.
* Show all peers on the bus, by their service names:
`busctl list`
* Show process information and credentials of a bus service, a process, or the owner of the bus (if no parameter is specified):
`busctl status {{service|pid}}`
* Dump messages being exchanged. If no service is specified, show all messages on the bus:
`busctl monitor {{service1 service2 ...}}`
* Show an object tree of one or more services (or all services if no service is specified):
`busctl tree {{service1 service2 ...}}`
* Show interfaces, methods, properties and signals of the specified object on the specified service:
`busctl introspect {{service}} {{path/to/object}}`
* Retrieve the current value of one or more object properties:
`busctl get-property {{service}} {{path/to/object}} {{interface_name}}
{{property_name}}`
* Invoke a method and show the response:
`busctl call {{service}} {{path/to/object}} {{interface_name}}
{{method_name}}`"
What is readlink command,,"# readlink
> Follow symlinks and get symlink information. More information:
> https://www.gnu.org/software/coreutils/readlink.
* Print the absolute path which the symlink points to:
`readlink {{path/to/symlink_file}}`"
What is sh command,,"# sh
> Bourne shell, the standard command language interpreter. See also
> `histexpand` for history expansion. More information: https://manned.org/sh.
* Start an interactive shell session:
`sh`
* Execute a command and then exit:
`sh -c ""{{command}}""`
* Execute a script:
`sh {{path/to/script.sh}}`
* Read and execute commands from `stdin`:
`sh -s`"
What is mpstat command,,"# mpstat
> Report CPU statistics. More information: https://manned.org/mpstat.
* Display CPU statistics every 2 seconds:
`mpstat {{2}}`
* Display 5 reports, one by one, at 2 second intervals:
`mpstat {{2}} {{5}}`
* Display 5 reports, one by one, from a given processor, at 2 second intervals:
`mpstat -P {{0}} {{2}} {{5}}`"
What is nm command,,"# nm
> List symbol names in object files. More information: https://manned.org/nm.
* List global (extern) functions in a file (prefixed with T):
`nm -g {{path/to/file.o}}`
* List only undefined symbols in a file:
`nm -u {{path/to/file.o}}`
* List all symbols, even debugging symbols:
`nm -a {{path/to/file.o}}`
* Demangle C++ symbols (make them readable):
`nm --demangle {{path/to/file.o}}`"
What is logger command,,"# logger
> Add messages to syslog (/var/log/syslog). More information:
> https://manned.org/logger.
* Log a message to syslog:
`logger {{message}}`
* Take input from `stdin` and log to syslog:
`echo {{log_entry}} | logger`
* Send the output to a remote syslog server running at a given port. Default port is 514:
`echo {{log_entry}} | logger --server {{hostname}} --port {{port}}`
* Use a specific tag for every line logged. Default is the name of logged in user:
`echo {{log_entry}} | logger --tag {{tag}}`
* Log messages with a given priority. Default is `user.notice`. See `man logger` for all priority options:
`echo {{log_entry}} | logger --priority {{user.warning}}`"
What is fallocate command,,"# fallocate
> Reserve or deallocate disk space to files. The utility allocates space
> without zeroing. More information: https://manned.org/fallocate.
* Reserve a file taking up 700 MiB of disk space:
`fallocate --length {{700M}} {{path/to/file}}`
* Shrink an already allocated file by 200 MiB:
`fallocate --collapse-range --length {{200M}} {{path/to/file}}`
* Shrink 20 MB of space after 100 MiB in a file:
`fallocate --collapse-range --offset {{100M}} --length {{20M}}
{{path/to/file}}`"
What is mkfifo command,,"# mkfifo
> Makes FIFOs (named pipes). More information:
> https://www.gnu.org/software/coreutils/mkfifo.
* Create a named pipe at a given path:
`mkfifo {{path/to/pipe}}`"
What is git-credential-store command,,"# git credential-store
> `git` helper to store passwords on disk. More information: https://git-
> scm.com/docs/git-credential-store.
* Store Git credentials in a specific file:
`git config credential.helper 'store --file={{path/to/file}}'`"
What is kill command,,"# kill
> Sends a signal to a process, usually related to stopping the process. All
> signals except for SIGKILL and SIGSTOP can be intercepted by the process to
> perform a clean exit. More information: https://manned.org/kill.
* Terminate a program using the default SIGTERM (terminate) signal:
`kill {{process_id}}`
* List available signal names (to be used without the `SIG` prefix):
`kill -l`
* Terminate a background job:
`kill %{{job_id}}`
* Terminate a program using the SIGHUP (hang up) signal. Many daemons will reload instead of terminating:
`kill -{{1|HUP}} {{process_id}}`
* Terminate a program using the SIGINT (interrupt) signal. This is typically initiated by the user pressing `Ctrl + C`:
`kill -{{2|INT}} {{process_id}}`
* Signal the operating system to immediately terminate a program (which gets no chance to capture the signal):
`kill -{{9|KILL}} {{process_id}}`
* Signal the operating system to pause a program until a SIGCONT (""continue"") signal is received:
`kill -{{17|STOP}} {{process_id}}`
* Send a `SIGUSR1` signal to all processes with the given GID (group id):
`kill -{{SIGUSR1}} -{{group_id}}`"
What is exec command,,"# exec
> Replace the current process with another process. More information:
> https://linuxcommand.org/lc3_man_pages/exech.html.
* Replace with the specified command using the current environment variables:
`exec {{command -with -flags}}`
* Replace with the specified command, clearing environment variables:
`exec -c {{command -with -flags}}`
* Replace with the specified command and login using the default shell:
`exec -l {{command -with -flags}}`
* Replace with the specified command and change the process name:
`exec -a {{process_name}} {{command -with -flags}}`"
What is ln command,,"# ln
> Creates links to files and directories. More information:
> https://www.gnu.org/software/coreutils/ln.
* Create a symbolic link to a file or directory:
`ln -s {{/path/to/file_or_directory}} {{path/to/symlink}}`
* Overwrite an existing symbolic link to point to a different file:
`ln -sf {{/path/to/new_file}} {{path/to/symlink}}`
* Create a hard link to a file:
`ln {{/path/to/file}} {{path/to/hardlink}}`"
What is sha224sum command,,"# sha224sum
> Calculate SHA224 cryptographic checksums. More information:
> https://www.gnu.org/software/coreutils/manual/html_node/sha2-utilities.html.
* Calculate the SHA224 checksum for one or more files:
`sha224sum {{path/to/file1 path/to/file2 ...}}`
* Calculate and save the list of SHA224 checksums to a file:
`sha224sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha224}}`
* Calculate a SHA224 checksum from `stdin`:
`{{command}} | sha224sum`
* Read a file of SHA224 sums and filenames and verify all files have matching checksums:
`sha224sum --check {{path/to/file.sha224}}`
* Only show a message for missing files or when verification fails:
`sha224sum --check --quiet {{path/to/file.sha224}}`
* Only show a message when verification fails, ignoring missing files:
`sha224sum --ignore-missing --check --quiet {{path/to/file.sha224}}`"
What is tr command,,"# tr
> Translate characters: run replacements based on single characters and
> character sets. More information: https://www.gnu.org/software/coreutils/tr.
* Replace all occurrences of a character in a file, and print the result:
`tr {{find_character}} {{replace_character}} < {{path/to/file}}`
* Replace all occurrences of a character from another command's output:
`echo {{text}} | tr {{find_character}} {{replace_character}}`
* Map each character of the first set to the corresponding character of the second set:
`tr '{{abcd}}' '{{jkmn}}' < {{path/to/file}}`
* Delete all occurrences of the specified set of characters from the input:
`tr -d '{{input_characters}}' < {{path/to/file}}`
* Compress a series of identical characters to a single character:
`tr -s '{{input_characters}}' < {{path/to/file}}`
* Translate the contents of a file to upper-case:
`tr ""[:lower:]"" ""[:upper:]"" < {{path/to/file}}`
* Strip out non-printable characters from a file:
`tr -cd ""[:print:]"" < {{path/to/file}}`"
What is chattr command,,"# chattr
> Change attributes of files or directories. More information:
> https://manned.org/chattr.
* Make a file or directory immutable to changes and deletion, even by superuser:
`chattr +i {{path/to/file_or_directory}}`
* Make a file or directory mutable:
`chattr -i {{path/to/file_or_directory}}`
* Recursively make an entire directory and contents immutable:
`chattr -R +i {{path/to/directory}}`"
What is git-reset command,,"# git reset
> Undo commits or unstage changes, by resetting the current Git HEAD to the
> specified state. If a path is passed, it works as ""unstage""; if a commit
> hash or branch is passed, it works as ""uncommit"". More information:
> https://git-scm.com/docs/git-reset.
* Unstage everything:
`git reset`
* Unstage specific file(s):
`git reset {{path/to/file1 path/to/file2 ...}}`
* Interactively unstage portions of a file:
`git reset --patch {{path/to/file}}`
* Undo the last commit, keeping its changes (and any further uncommitted changes) in the filesystem:
`git reset HEAD~`
* Undo the last two commits, adding their changes to the index, i.e. staged for commit:
`git reset --soft HEAD~2`
* Discard any uncommitted changes, staged or not (for only unstaged changes, use `git checkout`):
`git reset --hard`
* Reset the repository to a given commit, discarding committed, staged and uncommitted changes since then:
`git reset --hard {{commit}}`"
What is uuidgen command,,"# uuidgen
> Generate new UUID (Universally Unique IDentifier) strings. More information:
> https://www.ss64.com/osx/uuidgen.html.
* Generate a UUID string:
`uuidgen`"
What is git-clone command,,"# git clone
> Clone an existing repository. More information: https://git-
> scm.com/docs/git-clone.
* Clone an existing repository into a new directory (the default directory is the repository name):
`git clone {{remote_repository_location}} {{path/to/directory}}`
* Clone an existing repository and its submodules:
`git clone --recursive {{remote_repository_location}}`
* Clone only the `.git` directory of an existing repository:
`git clone --no-checkout {{remote_repository_location}}`
* Clone a local repository:
`git clone --local {{path/to/local/repository}}`
* Clone quietly:
`git clone --quiet {{remote_repository_location}}`
* Clone an existing repository only fetching the 10 most recent commits on the default branch (useful to save time):
`git clone --depth {{10}} {{remote_repository_location}}`
* Clone an existing repository only fetching a specific branch:
`git clone --branch {{name}} --single-branch {{remote_repository_location}}`
* Clone an existing repository using a specific SSH command:
`git clone --config core.sshCommand=""{{ssh -i path/to/private_ssh_key}}""
{{remote_repository_location}}`"
What is cups-config command,,"# cups-config
> Show technical information about your CUPS print server installation. More
> information: https://www.cups.org/doc/man-cups-config.html.
* Show the currently installed version of CUPS:
`cups-config --version`
* Show where CUPS is currently installed:
`cups-config --serverbin`
* Show the location of CUPS' configuration directory:
`cups-config --serverroot`
* Show the location of CUPS' data directory:
`cups-config --datadir`
* Display all available options:
`cups-config --help`"
What is mkfifo command,,"# mkfifo
> Makes FIFOs (named pipes). More information:
> https://www.gnu.org/software/coreutils/mkfifo.
* Create a named pipe at a given path:
`mkfifo {{path/to/pipe}}`"
What is logger command,,"# logger
> Add messages to syslog (/var/log/syslog). More information:
> https://manned.org/logger.
* Log a message to syslog:
`logger {{message}}`
* Take input from `stdin` and log to syslog:
`echo {{log_entry}} | logger`
* Send the output to a remote syslog server running at a given port. Default port is 514:
`echo {{log_entry}} | logger --server {{hostname}} --port {{port}}`
* Use a specific tag for every line logged. Default is the name of logged in user:
`echo {{log_entry}} | logger --tag {{tag}}`
* Log messages with a given priority. Default is `user.notice`. See `man logger` for all priority options:
`echo {{log_entry}} | logger --priority {{user.warning}}`"
What is git-apply command,,"# git apply
> Apply a patch to files and/or to the index without creating a commit. See
> also `git am`, which applies a patch and also creates a commit. More
> information: https://git-scm.com/docs/git-apply.
* Print messages about the patched files:
`git apply --verbose {{path/to/file}}`
* Apply and add the patched files to the index:
`git apply --index {{path/to/file}}`
* Apply a remote patch file:
`curl -L {{https://example.com/file.patch}} | git apply`
* Output diffstat for the input and apply the patch:
`git apply --stat --apply {{path/to/file}}`
* Apply the patch in reverse:
`git apply --reverse {{path/to/file}}`
* Store the patch result in the index without modifying the working tree:
`git apply --cache {{path/to/file}}`"
What is strings command,,"# strings
> Find printable strings in an object file or binary. More information:
> https://manned.org/strings.
* Print all strings in a binary:
`strings {{path/to/file}}`
* Limit results to strings at least length characters long:
`strings -n {{length}} {{path/to/file}}`
* Prefix each result with its offset within the file:
`strings -t d {{path/to/file}}`
* Prefix each result with its offset within the file in hexadecimal:
`strings -t x {{path/to/file}}`"
What is hexdump command,,"# hexdump
> An ASCII, decimal, hexadecimal, octal dump. More information:
> https://manned.org/hexdump.
* Print the hexadecimal representation of a file, replacing duplicate lines by '*':
`hexdump {{path/to/file}}`
* Display the input offset in hexadecimal and its ASCII representation in two columns:
`hexdump -C {{path/to/file}}`
* Display the hexadecimal representation of a file, but interpret only n bytes of the input:
`hexdump -C -n{{number_of_bytes}} {{path/to/file}}`
* Don't replace duplicate lines with '*':
`hexdump --no-squeezing {{path/to/file}}`"
What is git-update-index command,,"# git update-index
> Git command for manipulating the index. More information: https://git-
> scm.com/docs/git-update-index.
* Pretend that a modified file is unchanged (`git status` will not show this as changed):
`git update-index --skip-worktree {{path/to/modified_file}}`"
What is valgrind command,,"# valgrind
> Wrapper for a set of expert tools for profiling, optimizing and debugging
> programs. Commonly used tools include `memcheck`, `cachegrind`, `callgrind`,
> `massif`, `helgrind`, and `drd`. More information: http://www.valgrind.org.
* Use the (default) Memcheck tool to show a diagnostic of memory usage by `program`:
`valgrind {{program}}`
* Use Memcheck to report all possible memory leaks of `program` in full detail:
`valgrind --leak-check=full --show-leak-kinds=all {{program}}`
* Use the Cachegrind tool to profile and log CPU cache operations of `program`:
`valgrind --tool=cachegrind {{program}}`
* Use the Massif tool to profile and log heap memory and stack usage of `program`:
`valgrind --tool=massif --stacks=yes {{program}}`"
What is od command,,"# od
> Display file contents in octal, decimal or hexadecimal format. Optionally
> display the byte offsets and/or printable representation for each line. More
> information: https://www.gnu.org/software/coreutils/od.
* Display file using default settings: octal format, 8 bytes per line, byte offsets in octal, and duplicate lines replaced with `*`:
`od {{path/to/file}}`
* Display file in verbose mode, i.e. without replacing duplicate lines with `*`:
`od -v {{path/to/file}}`
* Display file in hexadecimal format (2-byte units), with byte offsets in decimal format:
`od --format={{x}} --address-radix={{d}} -v {{path/to/file}}`
* Display file in hexadecimal format (1-byte units), and 4 bytes per line:
`od --format={{x1}} --width={{4}} -v {{path/to/file}}`
* Display file in hexadecimal format along with its character representation, and do not print byte offsets:
`od --format={{xz}} --address-radix={{n}} -v {{path/to/file}}`
* Read only 100 bytes of a file starting from the 500th byte:
`od --read-bytes {{100}} --skip-bytes={{500}} -v {{path/to/file}}`"
What is uuencode command,,"# uuencode
> Encode binary files into ASCII for transport via mediums that only support
> simple ASCII encoding. More information: https://manned.org/uuencode.
* Encode a file and print the result to `stdout`:
`uuencode {{path/to/input_file}} {{output_file_name_after_decoding}}`
* Encode a file and write the result to a file:
`uuencode -o {{path/to/output_file}} {{path/to/input_file}}
{{output_file_name_after_decoding}}`
* Encode a file using Base64 instead of the default uuencode encoding and write the result to a file:
`uuencode -m -o {{path/to/output_file}} {{path/to/input_file}}
{{output_file_name_after_decoding}}`"
What is cmp command,,"# cmp
> Compare two files byte by byte. More information:
> https://www.gnu.org/software/diffutils/manual/html_node/Invoking-cmp.html.
* Output char and line number of the first difference between two files:
`cmp {{path/to/file1}} {{path/to/file2}}`
* Output info of the first difference: char, line number, bytes, and values:
`cmp --print-bytes {{path/to/file1}} {{path/to/file2}}`
* Output the byte numbers and values of every difference:
`cmp --verbose {{path/to/file1}} {{path/to/file2}}`
* Compare files but output nothing, yield only the exit status:
`cmp --quiet {{path/to/file1}} {{path/to/file2}}`"
What is hostname command,,"# hostname
> Show or set the system's host name. More information:
> https://manned.org/hostname.
* Show current host name:
`hostname`
* Show the network address of the host name:
`hostname -i`
* Show all network addresses of the host:
`hostname -I`
* Show the FQDN (Fully Qualified Domain Name):
`hostname --fqdn`
* Set current host name:
`hostname {{new_hostname}}`"
What is od command,,"# od
> Display file contents in octal, decimal or hexadecimal format. Optionally
> display the byte offsets and/or printable representation for each line. More
> information: https://www.gnu.org/software/coreutils/od.
* Display file using default settings: octal format, 8 bytes per line, byte offsets in octal, and duplicate lines replaced with `*`:
`od {{path/to/file}}`
* Display file in verbose mode, i.e. without replacing duplicate lines with `*`:
`od -v {{path/to/file}}`
* Display file in hexadecimal format (2-byte units), with byte offsets in decimal format:
`od --format={{x}} --address-radix={{d}} -v {{path/to/file}}`
* Display file in hexadecimal format (1-byte units), and 4 bytes per line:
`od --format={{x1}} --width={{4}} -v {{path/to/file}}`
* Display file in hexadecimal format along with its character representation, and do not print byte offsets:
`od --format={{xz}} --address-radix={{n}} -v {{path/to/file}}`
* Read only 100 bytes of a file starting from the 500th byte:
`od --read-bytes {{100}} --skip-bytes={{500}} -v {{path/to/file}}`"
What is b2sum command,,"# b2sum
> Calculate BLAKE2 cryptographic checksums. More information:
> https://www.gnu.org/software/coreutils/b2sum.
* Calculate the BLAKE2 checksum for one or more files:
`b2sum {{path/to/file1 path/to/file2 ...}}`
* Calculate and save the list of BLAKE2 checksums to a file:
`b2sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.b2}}`
* Calculate a BLAKE2 checksum from `stdin`:
`{{command}} | b2sum`
* Read a file of BLAKE2 sums and filenames and verify all files have matching checksums:
`b2sum --check {{path/to/file.b2}}`
* Only show a message for missing files or when verification fails:
`b2sum --check --quiet {{path/to/file.b2}}`
* Only show a message when verification fails, ignoring missing files:
`b2sum --ignore-missing --check --quiet {{path/to/file.b2}}`"
What is git-status command,,"# git status
> Show the changes to files in a Git repository. Lists changed, added and
> deleted files compared to the currently checked-out commit. More
> information: https://git-scm.com/docs/git-status.
* Show changed files which are not yet added for commit:
`git status`
* Give output in [s]hort format:
`git status -s`
* Don't show untracked files in the output:
`git status --untracked-files=no`
* Show output in [s]hort format along with [b]ranch info:
`git status -sb`"
What is time command,,"# time
> Measure how long a command took to run. Note: `time` can either exist as a
> shell builtin, a standalone program or both. More information:
> https://manned.org/time.
* Run the `command` and print the time measurements to `stdout`:
`time {{command}}`"
What is split command,,"# split
> Split a file into pieces. More information: https://ss64.com/osx/split.html.
* Split a file, each split having 10 lines (except the last split):
`split -l {{10}} {{filename}}`
* Split a file by a regular expression. The matching line will be the first line of the next output file:
`split -p {{cat|^[dh]og}} {{filename}}`
* Split a file with 512 bytes in each split (except the last split; use 512k for kilobytes and 512m for megabytes):
`split -b {{512}} {{filename}}`
* Split a file into 5 files. File is split such that each split has same size (except the last split):
`split -n {{5}} {{filename}}`"
What is su command,,"# su
> Switch shell to another user. More information: https://manned.org/su.
* Switch to superuser (requires the root password):
`su`
* Switch to a given user (requires the user's password):
`su {{username}}`
* Switch to a given user and simulate a full login shell:
`su - {{username}}`
* Execute a command as another user:
`su - {{username}} -c ""{{command}}""`"
What is w command,,"# w
> Show who is logged on and what they are doing. Print user login, TTY, remote
> host, login time, idle time, current process. More information:
> https://ss64.com/osx/w.html.
* Show logged-in users information:
`w`
* Show logged-in users information without a header:
`w -h`
* Show information about logged-in users, sorted by their idle time:
`w -i`"
What is git-reflog command,,"# git reflog
> Show a log of changes to local references like HEAD, branches or tags. More
> information: https://git-scm.com/docs/git-reflog.
* Show the reflog for HEAD:
`git reflog`
* Show the reflog for a given branch:
`git reflog {{branch_name}}`
* Show only the 5 latest entries in the reflog:
`git reflog -n {{5}}`"
What is git-cat-file command,,"# git cat-file
> Provide content or type and size information for Git repository objects.
> More information: https://git-scm.com/docs/git-cat-file.
* Get the [s]ize of the HEAD commit in bytes:
`git cat-file -s HEAD`
* Get the [t]ype (blob, tree, commit, tag) of a given Git object:
`git cat-file -t {{8c442dc3}}`
* Pretty-[p]rint the contents of a given Git object based on its type:
`git cat-file -p {{HEAD~2}}`"
What is clear command,,"# clear
> Clears the screen of the terminal. More information:
> https://manned.org/clear.
* Clear the screen (equivalent to pressing Control-L in Bash shell):
`clear`
* Clear the screen but keep the terminal's scrollback buffer:
`clear -x`
* Indicate the type of terminal to clean (defaults to the value of the environment variable `TERM`):
`clear -T {{type_of_terminal}}`
* Show the version of `ncurses` used by `clear`:
`clear -V`"
What is tput command,,"# tput
> View and modify terminal settings and capabilities. More information:
> https://manned.org/tput.
* Move the cursor to a screen location:
`tput cup {{row}} {{column}}`
* Set foreground (af) or background (ab) color:
`tput {{setaf|setab}} {{ansi_color_code}}`
* Show number of columns, lines, or colors:
`tput {{cols|lines|colors}}`
* Ring the terminal bell:
`tput bel`
* Reset all terminal attributes:
`tput sgr0`
* Enable or disable word wrap:
`tput {{smam|rmam}}`"
What is nice command,,"# nice
> Execute a program with a custom scheduling priority (niceness). Niceness
> values range from -20 (the highest priority) to 19 (the lowest). More
> information: https://www.gnu.org/software/coreutils/nice.
* Launch a program with altered priority:
`nice -n {{niceness_value}} {{command}}`"
What is echo command,,"# echo
> Print given arguments. More information:
> https://www.gnu.org/software/coreutils/echo.
* Print a text message. Note: quotes are optional:
`echo ""{{Hello World}}""`
* Print a message with environment variables:
`echo ""{{My path is $PATH}}""`
* Print a message without the trailing newline:
`echo -n ""{{Hello World}}""`
* Append a message to the file:
`echo ""{{Hello World}}"" >> {{file.txt}}`
* Enable interpretation of backslash escapes (special characters):
`echo -e ""{{Column 1\tColumn 2}}""`
* Print the exit status of the last executed command (Note: In Windows Command Prompt and PowerShell the equivalent commands are `echo %errorlevel%` and `$lastexitcode` respectively):
`echo $?`"
What is expand command,,"# expand
> Convert tabs to spaces. More information:
> https://www.gnu.org/software/coreutils/expand.
* Convert tabs in each file to spaces, writing to `stdout`:
`expand {{path/to/file}}`
* Convert tabs to spaces, reading from `stdin`:
`expand`
* Do not convert tabs after non blanks:
`expand -i {{path/to/file}}`
* Have tabs a certain number of characters apart, not 8:
`expand -t={{number}} {{path/to/file}}`
* Use a comma separated list of explicit tab positions:
`expand -t={{1,4,6}}`"
What is systemd-firstboot command,,"# systemd-firstboot
> Initialize basic system settings on or before the first boot-up of a system.
> More information: https://www.freedesktop.org/software/systemd/man/systemd-
> firstboot.html.
* Operate on the specified directory instead of the root directory of the host system:
`sudo systemd-firstboot --root={{path/to/root_directory}}`
* Set the system keyboard layout:
`sudo systemd-firstboot --keymap={{keymap}}`
* Set the system hostname:
`sudo systemd-firstboot --hostname={{hostname}}`
* Set the root user's password:
`sudo systemd-firstboot --root-password={{password}}`
* Prompt the user interactively for a specific basic setting:
`sudo systemd-firstboot --prompt={{setting}}`
* Force writing configuration even if the relevant files already exist:
`sudo systemd-firstboot --force`
* Remove all existing files that are configured by `systemd-firstboot`:
`sudo systemd-firstboot --reset`
* Remove the password of the system's root user:
`sudo systemd-firstboot --delete-root-password`"
What is last command,,"# last
> View the last logged in users. More information: https://manned.org/last.
* View last logins, their duration and other information as read from `/var/log/wtmp`:
`last`
* Specify how many of the last logins to show:
`last -n {{login_count}}`
* Print the full date and time for entries and then display the hostname column last to prevent truncation:
`last -F -a`
* View all logins by a specific user and show the IP address instead of the hostname:
`last {{username}} -i`
* View all recorded reboots (i.e., the last logins of the pseudo user ""reboot""):
`last reboot`
* View all recorded shutdowns (i.e., the last logins of the pseudo user ""shutdown""):
`last shutdown`"
What is flatpak command,,"# flatpak
> Build, install and run flatpak applications and runtimes. More information:
> https://docs.flatpak.org/en/latest/flatpak-command-reference.html#flatpak.
* Run an installed application:
`flatpak run {{name}}`
* Install an application from a remote source:
`flatpak install {{remote}} {{name}}`
* List all installed applications and runtimes:
`flatpak list`
* Update all installed applications and runtimes:
`flatpak update`
* Add a remote source:
`flatpak remote-add --if-not-exists {{remote_name}} {{remote_url}}`
* Remove an installed application:
`flatpak remove {{name}}`
* Remove all unused applications:
`flatpak remove --unused`
* Show information about an installed application:
`flatpak info {{name}}`"
What is cksum command,,"# cksum
> Calculates CRC checksums and byte counts of a file. Note, on old UNIX
> systems the CRC implementation may differ. More information:
> https://www.gnu.org/software/coreutils/cksum.
* Display a 32-bit checksum, size in bytes and filename:
`cksum {{path/to/file}}`"
What is git-for-each-repo command,,"# git for-each-repo
> Run a Git command on a list of repositories. Note: this command is
> experimental and may change. More information: https://git-scm.com/docs/git-
> for-each-repo.
* Run maintenance on each of a list of repositories stored in the `maintenance.repo` user configuration variable:
`git for-each-repo --config={{maintenance.repo}} {{maintenance run}}`
* Run `git pull` on each repository listed in a global configuration variable:
`git for-each-repo --config={{global_configuration_variable}} {{pull}}`"
What is more command,,"# more
> Open a file for interactive reading, allowing scrolling and search. More
> information: https://manned.org/more.
* Open a file:
`more {{path/to/file}}`
* Open a file displaying from a specific line:
`more +{{line_number}} {{path/to/file}}`
* Display help:
`more --help`
* Go to the next page:
`<Space>`
* Search for a string (press `n` to go to the next match):
`/{{something}}`
* Exit:
`q`
* Display help about interactive commands:
`h`"
What is apropos command,,"# apropos
> Search the manual pages for names and descriptions. More information:
> https://manned.org/apropos.
* Search for a keyword using a regular expression:
`apropos {{regular_expression}}`
* Search without restricting the output to the terminal width:
`apropos -l {{regular_expression}}`
* Search for pages that contain all the expressions given:
`apropos {{regular_expression_1}} -a {{regular_expression_2}} -a
{{regular_expression_3}}`"
What is cat command,,"# cat
> Print and concatenate files. More information:
> https://keith.github.io/xcode-man-pages/cat.1.html.
* Print the contents of a file to `stdout`:
`cat {{path/to/file}}`
* Concatenate several files into an output file:
`cat {{path/to/file1 path/to/file2 ...}} > {{path/to/output_file}}`
* Append several files to an output file:
`cat {{path/to/file1 path/to/file2 ...}} >> {{path/to/output_file}}`
* Copy the contents of a file into an output file without buffering:
`cat -u {{/dev/tty12}} > {{/dev/tty13}}`
* Write `stdin` to a file:
`cat - > {{path/to/file}}`
* Number all output lines:
`cat -n {{path/to/file}}`
* Display non-printable and whitespace characters (with `M-` prefix if non-ASCII):
`cat -v -t -e {{path/to/file}}`"
What is arch command,,"# arch
> Display the name of the system architecture, or run a command under a
> different architecture. See also `uname`. More information:
> https://www.unix.com/man-page/osx/1/arch/.
* Display the system's architecture:
`arch`
* Run a command using x86_64:
`arch -x86_64 ""{{command}}""`
* Run a command using arm:
`arch -arm64 ""{{command}}""`"
What is update-alternatives command,,"# update-alternatives
> A convenient tool for maintaining symbolic links to determine default
> commands. More information: https://manned.org/update-alternatives.
* Add a symbolic link:
`sudo update-alternatives --install {{path/to/symlink}} {{command_name}}
{{path/to/command_binary}} {{priority}}`
* Configure a symbolic link for `java`:
`sudo update-alternatives --config {{java}}`
* Remove a symbolic link:
`sudo update-alternatives --remove {{java}}
{{/opt/java/jdk1.8.0_102/bin/java}}`
* Display information about a specified command:
`update-alternatives --display {{java}}`
* Display all commands and their current selection:
`update-alternatives --get-selections`"
What is mailx command,,"# mailx
> Send and receive mail. More information: https://manned.org/mailx.
* Send mail (the content should be typed after the command, and ended with `Ctrl+D`):
`mailx -s ""{{subject}}"" {{to_addr}}`
* Send mail with content passed from another command:
`echo ""{{content}}"" | mailx -s ""{{subject}}"" {{to_addr}}`
* Send mail with content read from a file:
`mailx -s ""{{subject}}"" {{to_addr}} < {{content.txt}}`
* Send mail to a recipient and CC to another address:
`mailx -s ""{{subject}}"" -c {{cc_addr}} {{to_addr}}`
* Send mail specifying the sender address:
`mailx -s ""{{subject}}"" -r {{from_addr}} {{to_addr}}`
* Send mail with an attachment:
`mailx -a {{path/to/file}} -s ""{{subject}}"" {{to_addr}}`"
What is dot command,,"# dot
> Render an image of a `linear directed` network graph from a `graphviz` file.
> Layouts: `dot`, `neato`, `twopi`, `circo`, `fdp`, `sfdp`, `osage` &
> `patchwork`. More information: https://graphviz.org/doc/info/command.html.
* Render a `png` image with a filename based on the input filename and output format (uppercase -O):
`dot -T {{png}} -O {{path/to/input.gv}}`
* Render a `svg` image with the specified output filename (lowercase -o):
`dot -T {{svg}} -o {{path/to/image.svg}} {{path/to/input.gv}}`
* Render the output in `ps`, `pdf`, `svg`, `fig`, `png`, `gif`, `jpg`, `json`, or `dot` format:
`dot -T {{format}} -O {{path/to/input.gv}}`
* Render a `gif` image using `stdin` and `stdout`:
`echo ""{{digraph {this -> that} }}"" | dot -T {{gif}} > {{path/to/image.gif}}`
* Display help:
`dot -?`"
What is gcc command,,"# gcc
> Preprocess and compile C and C++ source files, then assemble and link them
> together. More information: https://gcc.gnu.org.
* Compile multiple source files into an executable:
`gcc {{path/to/source1.c path/to/source2.c ...}} -o
{{path/to/output_executable}}`
* Show common warnings, debug symbols in output, and optimize without affecting debugging:
`gcc {{path/to/source.c}} -Wall -g -Og -o {{path/to/output_executable}}`
* Include libraries from a different path:
`gcc {{path/to/source.c}} -o {{path/to/output_executable}}
-I{{path/to/header}} -L{{path/to/library}} -l{{library_name}}`
* Compile source code into Assembler instructions:
`gcc -S {{path/to/source.c}}`
* Compile source code into an object file without linking:
`gcc -c {{path/to/source.c}}`"
What is whoami command,,"# whoami
> Print the username associated with the current effective user ID. More
> information: https://www.gnu.org/software/coreutils/whoami.
* Display currently logged username:
`whoami`
* Display the username after a change in the user ID:
`sudo whoami`"
What is gitk command,,"# gitk
> A graphical Git repository browser. More information: https://git-
> scm.com/docs/gitk.
* Show the repository browser for the current Git repository:
`gitk`
* Show repository browser for a specific file or directory:
`gitk {{path/to/file_or_directory}}`
* Show commits made since 1 week ago:
`gitk --since=""{{1 week ago}}""`
* Show commits older than 1/1/2016:
`gitk --until=""{{1/1/2015}}""`
* Show at most 100 changes in all branches:
`gitk --max-count={{100}} --all`"
What is realpath command,,"# realpath
> Display the resolved absolute path for a file or directory. More
> information: https://www.gnu.org/software/coreutils/realpath.
* Display the absolute path for a file or directory:
`realpath {{path/to/file_or_directory}}`
* Require all path components to exist:
`realpath --canonicalize-existing {{path/to/file_or_directory}}`
* Resolve "".."" components before symlinks:
`realpath --logical {{path/to/file_or_directory}}`
* Disable symlink expansion:
`realpath --no-symlinks {{path/to/file_or_directory}}`
* Suppress error messages:
`realpath --quiet {{path/to/file_or_directory}}`"
What is csplit command,,"# csplit
> Split a file into pieces. This generates files named ""xx00"", ""xx01"", and so
> on. More information: https://www.gnu.org/software/coreutils/csplit.
* Split a file at lines 5 and 23:
`csplit {{path/to/file}} {{5}} {{23}}`
* Split a file every 5 lines (this will fail if the total number of lines is not divisible by 5):
`csplit {{path/to/file}} {{5}} {*}`
* Split a file every 5 lines, ignoring exact-division error:
`csplit -k {{path/to/file}} {{5}} {*}`
* Split a file at line 5 and use a custom prefix for the output files:
`csplit {{path/to/file}} {{5}} -f {{prefix}}`
* Split a file at a line matching a regular expression:
`csplit {{path/to/file}} /{{regular_expression}}/`"
What is ps command,,"# ps
> Information about running processes. More information:
> https://www.unix.com/man-page/osx/1/ps/.
* List all running processes:
`ps aux`
* List all running processes including the full command string:
`ps auxww`
* Search for a process that matches a string:
`ps aux | grep {{string}}`
* Get the parent PID of a process:
`ps -o ppid= -p {{pid}}`
* Sort processes by memory usage:
`ps -m`
* Sort processes by CPU usage:
`ps -r`"
What is journalctl command,,"# journalctl
> Query the systemd journal. More information: https://manned.org/journalctl.
* Show all messages with priority level 3 (errors) from this [b]oot:
`journalctl -b --priority={{3}}`
* Show all messages from last [b]oot:
`journalctl -b -1`
* Delete journal logs which are older than 2 days:
`journalctl --vacuum-time={{2d}}`
* [f]ollow new messages (like `tail -f` for traditional syslog):
`journalctl -f`
* Show all messages by a specific [u]nit:
`journalctl -u {{unit}}`
* Filter messages within a time range (either timestamp or placeholders like ""yesterday""):
`journalctl --since {{now|today|yesterday|tomorrow}} --until {{YYYY-MM-DD
HH:MM:SS}}`
* Show all messages by a specific process:
`journalctl _PID={{pid}}`
* Show all messages by a specific executable:
`journalctl {{path/to/executable}}`"
What is head command,,"# head
> Output the first part of files. More information:
> https://keith.github.io/xcode-man-pages/head.1.html.
* Output the first few lines of a file:
`head --lines {{8}} {{path/to/file}}`
* Output the first few bytes of a file:
`head --bytes {{8}} {{path/to/file}}`
* Output everything but the last few lines of a file:
`head --lines -{{8}} {{path/to/file}}`
* Output everything but the last few bytes of a file:
`head --bytes -{{8}} {{path/to/file}}`"
What is basename command,,"# basename
> Remove leading directory portions from a path. More information:
> https://www.gnu.org/software/coreutils/basename.
* Show only the file name from a path:
`basename {{path/to/file}}`
* Show only the rightmost directory name from a path:
`basename {{path/to/directory/}}`
* Show only the file name from a path, with a suffix removed:
`basename {{path/to/file}} {{suffix}}`"
What is git-maintenance command,,"# git-maintenance
> Run tasks to optimize Git repository data. More information: https://git-
> scm.com/docs/git-maintenance.
* Register the current repository in the user's list of repositories to daily have maintenance run:
`git maintenance register`
* Start running maintenance on the current repository:
`git maintenance start`
* Halt the background maintenance schedule for the current repository:
`git maintenance stop`
* Remove the current repository from the user's maintenance repository list:
`git maintenance unregister`
* Run a specific maintenance task on the current repository:
`git maintenance run --task={{commit-graph|gc|incremental-repack|loose-
objects|pack-refs|prefetch}}`"
What is git-diff-files command,,"# git diff-files
> Compare files using their sha1 hashes and modes. More information:
> https://git-scm.com/docs/git-diff-files.
* Compare all changed files:
`git diff-files`
* Compare only specified files:
`git diff-files {{path/to/file}}`
* Show only the names of changed files:
`git diff-files --name-only`
* Output a summary of extended header information:
`git diff-files --summary`"
What is expr command,,"# expr
> Evaluate expressions and manipulate strings. More information:
> https://www.gnu.org/software/coreutils/expr.
* Get the length of a specific string:
`expr length ""{{string}}""`
* Get the substring of a string with a specific length:
`expr substr ""{{string}}"" {{from}} {{length}}`
* Match a specific substring against an anchored pattern:
`expr match ""{{string}}"" '{{pattern}}'`
* Get the first char position from a specific set in a string:
`expr index ""{{string}}"" ""{{chars}}""`
* Calculate a specific mathematic expression:
`expr {{expression1}} {{+|-|*|/|%}} {{expression2}}`
* Get the first expression if its value is non-zero and not null otherwise get the second one:
`expr {{expression1}} \| {{expression2}}`
* Get the first expression if both expressions are non-zero and not null otherwise get zero:
`expr {{expression1}} \& {{expression2}}`"
What is mv command,,"# mv
> Move or rename files and directories. More information:
> https://www.gnu.org/software/coreutils/mv.
* Rename a file or directory when the target is not an existing directory:
`mv {{path/to/source}} {{path/to/target}}`
* Move a file or directory into an existing directory:
`mv {{path/to/source}} {{path/to/existing_directory}}`
* Move multiple files into an existing directory, keeping the filenames unchanged:
`mv {{path/to/source1 path/to/source2 ...}} {{path/to/existing_directory}}`
* Do not prompt for confirmation before overwriting existing files:
`mv -f {{path/to/source}} {{path/to/target}}`
* Prompt for confirmation before overwriting existing files, regardless of file permissions:
`mv -i {{path/to/source}} {{path/to/target}}`
* Do not overwrite existing files at the target:
`mv -n {{path/to/source}} {{path/to/target}}`
* Move files in verbose mode, showing files after they are moved:
`mv -v {{path/to/source}} {{path/to/target}}`"
What is loginctl command,,"# loginctl
> Manage the systemd login manager. More information:
> https://www.freedesktop.org/software/systemd/man/loginctl.html.
* Print all current sessions:
`loginctl list-sessions`
* Print all properties of a specific session:
`loginctl show-session {{session_id}} --all`
* Print all properties of a specific user:
`loginctl show-user {{username}}`
* Print a specific property of a user:
`loginctl show-user {{username}} --property={{property_name}}`
* Execute a `loginctl` operation on a remote host:
`loginctl list-users -H {{hostname}}`"
What is cut command,,"# cut
> Cut out fields from `stdin` or files. More information:
> https://manned.org/man/freebsd-13.0/cut.1.
* Print a specific character/field range of each line:
`{{command}} | cut -{{c|f}} {{1|1,10|1-10|1-|-10}}`
* Print a range of each line with a specific delimiter:
`{{command}} | cut -d ""{{,}}"" -{{c}} {{1}}`
* Print a range of each line of a specific file:
`cut -{{c}} {{1}} {{path/to/file}}`"
What is kill command,,"# kill
> Sends a signal to a process, usually related to stopping the process. All
> signals except for SIGKILL and SIGSTOP can be intercepted by the process to
> perform a clean exit. More information: https://manned.org/kill.
* Terminate a program using the default SIGTERM (terminate) signal:
`kill {{process_id}}`
* List available signal names (to be used without the `SIG` prefix):
`kill -l`
* Terminate a background job:
`kill %{{job_id}}`
* Terminate a program using the SIGHUP (hang up) signal. Many daemons will reload instead of terminating:
`kill -{{1|HUP}} {{process_id}}`
* Terminate a program using the SIGINT (interrupt) signal. This is typically initiated by the user pressing `Ctrl + C`:
`kill -{{2|INT}} {{process_id}}`
* Signal the operating system to immediately terminate a program (which gets no chance to capture the signal):
`kill -{{9|KILL}} {{process_id}}`
* Signal the operating system to pause a program until a SIGCONT (""continue"") signal is received:
`kill -{{17|STOP}} {{process_id}}`
* Send a `SIGUSR1` signal to all processes with the given GID (group id):
`kill -{{SIGUSR1}} -{{group_id}}`"
What is sleep command,,"# sleep
> Delay for a specified amount of time. More information:
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sleep.html.
* Delay in seconds:
`sleep {{seconds}}`
* Execute a specific command after 20 seconds delay:
`sleep 20 && {{command}}`"
What is printf command,,"# printf
> Format and print text. More information:
> https://www.gnu.org/software/coreutils/printf.
* Print a text message:
`printf ""{{%s\n}}"" ""{{Hello world}}""`
* Print an integer in bold blue:
`printf ""{{\e[1;34m%.3d\e[0m\n}}"" {{42}}`
* Print a float number with the Unicode Euro sign:
`printf ""{{\u20AC %.2f\n}}"" {{123.4}}`
* Print a text message composed with environment variables:
`printf ""{{var1: %s\tvar2: %s\n}}"" ""{{$VAR1}}"" ""{{$VAR2}}""`
* Store a formatted message in a variable (does not work on zsh):
`printf -v {{myvar}} {{""This is %s = %d\n"" ""a year"" 2016}}`"
What is c99 command,,"# c99
> Compiles C programs according to the ISO C standard. More information:
> https://manned.org/c99.
* Compile source file(s) and create an executable:
`c99 {{file.c}}`
* Compile source file(s) and create an executable with a custom name:
`c99 -o {{executable_name}} {{file.c}}`
* Compile source file(s) and create object file(s):
`c99 -c {{file.c}}`
* Compile source file(s), link with object file(s), and create an executable:
`c99 {{file.c}} {{file.o}}`"
What is runuser command,,"# runuser
> Run commands as a specific user and group without asking for password (needs
> root privileges). More information: https://manned.org/runuser.
* Run command as a different user:
`runuser {{user}} -c '{{command}}'`
* Run command as a different user and group:
`runuser {{user}} -g {{group}} -c '{{command}}'`
* Start a login shell as a specific user:
`runuser {{user}} -l`
* Specify a shell for running instead of the default shell (also works for login):
`runuser {{user}} -s {{/bin/sh}}`
* Preserve the entire environment of root (only if `--login` is not specified):
`runuser {{user}} --preserve-environment -c '{{command}}'`"
What is man command,,"# man
> Format and display manual pages. More information:
> https://www.man7.org/linux/man-pages/man1/man.1.html.
* Display the man page for a command:
`man {{command}}`
* Display the man page for a command from section 7:
`man {{7}} {{command}}`
* List all available sections for a command:
`man -f {{command}}`
* Display the path searched for manpages:
`man --path`
* Display the location of a manpage rather than the manpage itself:
`man -w {{command}}`
* Display the man page using a specific locale:
`man {{command}} --locale={{locale}}`
* Search for manpages containing a search string:
`man -k ""{{search_string}}""`"
What is git-cherry command,,"# git cherry
> Find commits that have yet to be applied upstream. More information:
> https://git-scm.com/docs/git-cherry.
* Show commits (and their messages) with equivalent commits upstream:
`git cherry -v`
* Specify a different upstream and topic branch:
`git cherry {{origin}} {{topic}}`
* Limit commits to those within a given limit:
`git cherry {{origin}} {{topic}} {{base}}`"
What is fold command,,"# fold
> Wrap each line in an input file to fit a specified width and print it to
> `stdout`. More information: https://manned.org/fold.1p.
* Wrap each line to default width (80 characters):
`fold {{path/to/file}}`
* Wrap each line to width ""30"":
`fold -w30 {{path/to/file}}`
* Wrap each line to width ""5"" and break the line at spaces (puts each space separated word in a new line, words with length > 5 are wrapped):
`fold -w5 -s {{path/to/file}}`"
What is dirname command,,"# dirname
> Calculates the parent directory of a given file or directory path. More
> information: https://www.gnu.org/software/coreutils/dirname.
* Calculate the parent directory of a given path:
`dirname {{path/to/file_or_directory}}`
* Calculate the parent directory of multiple paths:
`dirname {{path/to/file_a}} {{path/to/directory_b}}`
* Delimit output with a NUL character instead of a newline (useful when combining with `xargs`):
`dirname --zero {{path/to/directory_a}} {{path/to/file_b}}`"
What is tsort command,,"# tsort
> Perform a topological sort. A common use is to show the dependency order of
> nodes in a directed acyclic graph. More information:
> https://www.gnu.org/software/coreutils/tsort.
* Perform a topological sort consistent with a partial sort per line of input separated by blanks:
`tsort {{path/to/file}}`
* Perform a topological sort consistent on strings:
`echo -e ""{{UI Backend\nBackend Database\nDocs UI}}"" | tsort`"
What is base32 command,,"# base32
> Encode or decode file or `stdin` to/from Base32, to `stdout`. More
> information: https://www.gnu.org/software/coreutils/base32.
* Encode a file:
`base32 {{path/to/file}}`
* Decode a file:
`base32 --decode {{path/to/file}}`
* Encode from `stdin`:
`{{somecommand}} | base32`
* Decode from `stdin`:
`{{somecommand}} | base32 --decode`"
What is git-commit-tree command,,"# git commit-tree
> Low level utility to create commit objects. See also: `git commit`. More
> information: https://git-scm.com/docs/git-commit-tree.
* Create a commit object with the specified message:
`git commit-tree {{tree}} -m ""{{message}}""`
* Create a commit object reading the message from a file (use `-` for `stdin`):
`git commit-tree {{tree}} -F {{path/to/file}}`
* Create a GPG-signed commit object:
`git commit-tree {{tree}} -m ""{{message}}"" --gpg-sign`
* Create a commit object with the specified parent commit object:
`git commit-tree {{tree}} -m ""{{message}}"" -p {{parent_commit_sha}}`"
What is reset command,,"# reset
> Reinitializes the current terminal. Clears the entire terminal screen. More
> information: https://manned.org/reset.
* Reinitialize the current terminal:
`reset`
* Display the terminal type instead:
`reset -q`"
What is git-init command,,"# git init
> Initializes a new local Git repository. More information: https://git-
> scm.com/docs/git-init.
* Initialize a new local repository:
`git init`
* Initialize a repository with the specified name for the initial branch:
`git init --initial-branch={{branch_name}}`
* Initialize a repository using SHA256 for object hashes (requires Git version 2.29+):
`git init --object-format={{sha256}}`
* Initialize a barebones repository, suitable for use as a remote over ssh:
`git init --bare`"
What is csplit command,,"# csplit
> Split a file into pieces. This generates files named ""xx00"", ""xx01"", and so
> on. More information: https://www.gnu.org/software/coreutils/csplit.
* Split a file at lines 5 and 23:
`csplit {{path/to/file}} {{5}} {{23}}`
* Split a file every 5 lines (this will fail if the total number of lines is not divisible by 5):
`csplit {{path/to/file}} {{5}} {*}`
* Split a file every 5 lines, ignoring exact-division error:
`csplit -k {{path/to/file}} {{5}} {*}`
* Split a file at line 5 and use a custom prefix for the output files:
`csplit {{path/to/file}} {{5}} -f {{prefix}}`
* Split a file at a line matching a regular expression:
`csplit {{path/to/file}} /{{regular_expression}}/`"
What is make command,,"# make
> Task runner for targets described in Makefile. Mostly used to control the
> compilation of an executable from source code. More information:
> https://www.gnu.org/software/make/manual/make.html.
* Call the first target specified in the Makefile (usually named ""all""):
`make`
* Call a specific target:
`make {{target}}`
* Call a specific target, executing 4 jobs at a time in parallel:
`make -j{{4}} {{target}}`
* Use a specific Makefile:
`make --file {{path/to/file}}`
* Execute make from another directory:
`make --directory {{path/to/directory}}`
* Force making of a target, even if source files are unchanged:
`make --always-make {{target}}`
* Override a variable defined in the Makefile:
`make {{target}} {{variable}}={{new_value}}`
* Override variables defined in the Makefile by the environment:
`make --environment-overrides {{target}}`"
What is sed command,,"# sed
> Edit text in a scriptable manner. See also: `awk`, `ed`. More information:
> https://keith.github.io/xcode-man-pages/sed.1.html.
* Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in all input lines and print the result to `stdout`:
`{{command}} | sed 's/apple/mango/g'`
* Execute a specific script [f]ile and print the result to `stdout`:
`{{command}} | sed -f {{path/to/script_file.sed}}`
* Replace all `apple` (extended regex) occurrences with `APPLE` (extended regex) in all input lines and print the result to `stdout`:
`{{command}} | sed -E 's/(apple)/\U\1/g'`
* Print just a first line to `stdout`:
`{{command}} | sed -n '1p'`
* Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in a `file` and save a backup of the original to `file.bak`:
`sed -i bak 's/apple/mango/g' {{path/to/file}}`"
What is dash command,,"# dash
> Debian Almquist Shell, a modern, POSIX-compliant implementation of `sh` (not
> Bash-compatible). More information: https://manned.org/dash.
* Start an interactive shell session:
`dash`
* Execute specific [c]ommands:
`dash -c ""{{echo 'dash is executed'}}""`
* Execute a specific script:
`dash {{path/to/script.sh}}`
* Check a specific script for syntax errors:
`dash -n {{path/to/script.sh}}`
* Execute a specific script while printing each command before executing it:
`dash -x {{path/to/script.sh}}`
* Execute a specific script and stop at the first [e]rror:
`dash -e {{path/to/script.sh}}`
* Execute specific commands from `stdin`:
`{{echo ""echo 'dash is executed'""}} | dash`"
What is ex command,,"# ex
> Command-line text editor. See also: `vim`. More information:
> https://www.vim.org.
* Open a file:
`ex {{path/to/file}}`
* Save and Quit:
`wq<Enter>`
* Undo the last operation:
`undo<Enter>`
* Search for a pattern in the file:
`/{{search_pattern}}<Enter>`
* Perform a regular expression substitution in the whole file:
`%s/{{regular_expression}}/{{replacement}}/g<Enter>`
* Insert text:
`i<Enter>{{text}}<C-c>`
* Switch to Vim:
`visual<Enter>`"
What is time command,,"# time
> Measure how long a command took to run. Note: `time` can either exist as a
> shell builtin, a standalone program or both. More information:
> https://manned.org/time.
* Run the `command` and print the time measurements to `stdout`:
`time {{command}}`"
What is printf command,,"# printf
> Format and print text. More information:
> https://www.gnu.org/software/coreutils/printf.
* Print a text message:
`printf ""{{%s\n}}"" ""{{Hello world}}""`
* Print an integer in bold blue:
`printf ""{{\e[1;34m%.3d\e[0m\n}}"" {{42}}`
* Print a float number with the Unicode Euro sign:
`printf ""{{\u20AC %.2f\n}}"" {{123.4}}`
* Print a text message composed with environment variables:
`printf ""{{var1: %s\tvar2: %s\n}}"" ""{{$VAR1}}"" ""{{$VAR2}}""`
* Store a formatted message in a variable (does not work on zsh):
`printf -v {{myvar}} {{""This is %s = %d\n"" ""a year"" 2016}}`"
What is pwd command,,"# pwd
> Print name of current/working directory. More information:
> https://www.gnu.org/software/coreutils/pwd.
* Print the current directory:
`pwd`
* Print the current directory, and resolve all symlinks (i.e. show the ""physical"" path):
`pwd -P`"
What is loadkeys command,,"# loadkeys
> Load the kernel keymap for the console. More information:
> https://manned.org/loadkeys.
* Load a default keymap:
`loadkeys --default`
* Load default keymap when an unusual keymap is loaded and `-` sign cannot be found:
`loadkeys defmap`
* Create a kernel source table:
`loadkeys --mktable`
* Create a binary keymap:
`loadkeys --bkeymap`
* Search and parse keymap without action:
`loadkeys --parse`
* Load the keymap suppressing all output:
`loadkeys --quiet`
* Load a keymap from the specified file for the console:
`loadkeys --console {{/dev/ttyN}} {{/path/to/file}}`
* Use standard names for keymaps of different locales:
`loadkeys --console {{/dev/ttyN}} {{uk}}`"
What is env command,,"# env
> Show the environment or run a program in a modified environment. More
> information: https://www.gnu.org/software/coreutils/env.
* Show the environment:
`env`
* Run a program. Often used in scripts after the shebang (#!) for looking up the path to the program:
`env {{program}}`
* Clear the environment and run a program:
`env -i {{program}}`
* Remove variable from the environment and run a program:
`env -u {{variable}} {{program}}`
* Set a variable and run a program:
`env {{variable}}={{value}} {{program}}`
* Set multiple variables and run a program:
`env {{variable1}}={{value}} {{variable2}}={{value}} {{variable3}}={{value}}
{{program}}`"
What is look command,,"# look
> Look for lines in sorted file. More information: https://manned.org/look.
* Look for lines which begins with the given prefix:
`look {{prefix}} {{path/to/file}}`
* Look for lines ignoring case:
`look --ignore-case {{prefix}} {{path/to/file}}`"
What is fgrep command,,"# fgrep
> Matches fixed strings in files. Equivalent to `grep -F`. More information:
> https://www.gnu.org/software/grep/manual/grep.html.
* Search for an exact string in a file:
`fgrep {{search_string}} {{path/to/file}}`
* Search only lines that match entirely in files:
`fgrep -x {{path/to/file1}} {{path/to/file2}}`
* Count the number of lines that match the given string in a file:
`fgrep -c {{search_string}} {{path/to/file}}`
* Show the line number in the file along with the line matched:
`fgrep -n {{search_string}} {{path/to/file}}`
* Display all lines except those that contain the search string:
`fgrep -v {{search_string}} {{path/to/file}}`
* Display filenames whose content matches the search string at least once:
`fgrep -l {{search_string}} {{path/to/file1}} {{path/to/file2}}`"
What is df command,,"# df
> Gives an overview of the filesystem disk space usage. More information:
> https://www.gnu.org/software/coreutils/df.
* Display all filesystems and their disk usage:
`df`
* Display all filesystems and their disk usage in human-readable form:
`df -h`
* Display the filesystem and its disk usage containing the given file or directory:
`df {{path/to/file_or_directory}}`
* Display statistics on the number of free inodes:
`df -i`
* Display filesystems but exclude the specified types:
`df -x {{squashfs}} -x {{tmpfs}}`"
What is sha512sum command,,"# sha512sum
> Calculate SHA512 cryptographic checksums. More information:
> https://www.gnu.org/software/coreutils/manual/html_node/sha2-utilities.html.
* Calculate the SHA512 checksum for one or more files:
`sha512sum {{path/to/file1 path/to/file2 ...}}`
* Calculate and save the list of SHA512 checksums to a file:
`sha512sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha512}}`
* Calculate a SHA512 checksum from `stdin`:
`{{command}} | sha512sum`
* Read a file of SHA512 sums and filenames and verify all files have matching checksums:
`sha512sum --check {{path/to/file.sha512}}`
* Only show a message for missing files or when verification fails:
`sha512sum --check --quiet {{path/to/file.sha512}}`
* Only show a message when verification fails, ignoring missing files:
`sha512sum --ignore-missing --check --quiet {{path/to/file.sha512}}`"
What is dpkg-deb command,,"# dpkg-deb
> Pack, unpack and provide information about Debian archives. More
> information: https://manpages.debian.org/latest/dpkg/dpkg-deb.html.
* Display information about a package:
`dpkg-deb --info {{path/to/file.deb}}`
* Display the package's name and version on one line:
`dpkg-deb --show {{path/to/file.deb}}`
* List the package's contents:
`dpkg-deb --contents {{path/to/file.deb}}`
* Extract package's contents into a directory:
`dpkg-deb --extract {{path/to/file.deb}} {{path/to/directory}}`
* Create a package from a specified directory:
`dpkg-deb --build {{path/to/directory}}`"
What is updatedb command,,"# updatedb
> Create or update the database used by `locate`. It is usually run daily by
> cron. More information: https://manned.org/updatedb.
* Refresh database content:
`sudo updatedb`
* Display file names as soon as they are found:
`sudo updatedb --verbose`"
What is sort command,,"# sort
> Sort lines of text files. More information:
> https://www.gnu.org/software/coreutils/sort.
* Sort a file in ascending order:
`sort {{path/to/file}}`
* Sort a file in descending order:
`sort --reverse {{path/to/file}}`
* Sort a file in case-insensitive way:
`sort --ignore-case {{path/to/file}}`
* Sort a file using numeric rather than alphabetic order:
`sort --numeric-sort {{path/to/file}}`
* Sort `/etc/passwd` by the 3rd field of each line numerically, using "":"" as a field separator:
`sort --field-separator={{:}} --key={{3n}} {{/etc/passwd}}`
* Sort a file preserving only unique lines:
`sort --unique {{path/to/file}}`
* Sort a file, printing the output to the specified output file (can be used to sort a file in-place):
`sort --output={{path/to/file}} {{path/to/file}}`
* Sort numbers with exponents:
`sort --general-numeric-sort {{path/to/file}}`"
What is lex command,,"# lex
> Lexical analyzer generator. Given the specification for a lexical analyzer,
> generates C code implementing it. More information:
> https://keith.github.io/xcode-man-pages/lex.1.html.
* Generate an analyzer from a Lex file:
`lex {{analyzer.l}}`
* Specify the output file:
`lex {{analyzer.l}} --outfile {{analyzer.c}}`
* Compile a C file generated by Lex:
`cc {{path/to/lex.yy.c}} --output {{executable}}`"
What is ulimit command,,"# ulimit
> Get and set user limits. More information: https://manned.org/ulimit.
* Get the properties of all the user limits:
`ulimit -a`
* Get hard limit for the number of simultaneously opened files:
`ulimit -H -n`
* Get soft limit for the number of simultaneously opened files:
`ulimit -S -n`
* Set max per-user process limit:
`ulimit -u 30`"
What is chfn command,,"# chfn
> Update `finger` info for a user. More information: https://manned.org/chfn.
* Update a user's ""Name"" field in the output of `finger`:
`chfn -f {{new_display_name}} {{username}}`
* Update a user's ""Office Room Number"" field for the output of `finger`:
`chfn -o {{new_office_room_number}} {{username}}`
* Update a user's ""Office Phone Number"" field for the output of `finger`:
`chfn -p {{new_office_telephone_number}} {{username}}`
* Update a user's ""Home Phone Number"" field for the output of `finger`:
`chfn -h {{new_home_telephone_number}} {{username}}`"
What is nice command,,"# nice
> Execute a program with a custom scheduling priority (niceness). Niceness
> values range from -20 (the highest priority) to 19 (the lowest). More
> information: https://www.gnu.org/software/coreutils/nice.
* Launch a program with altered priority:
`nice -n {{niceness_value}} {{command}}`"
What is tail command,,"# tail
> Display the last part of a file. See also: `head`. More information:
> https://manned.org/man/freebsd-13.0/tail.1.
* Show last 'count' lines in file:
`tail -n {{8}} {{path/to/file}}`
* Print a file from a specific line number:
`tail -n +{{8}} {{path/to/file}}`
* Print a specific count of bytes from the end of a given file:
`tail -c {{8}} {{path/to/file}}`
* Print the last lines of a given file and keep reading file until `Ctrl + C`:
`tail -f {{path/to/file}}`
* Keep reading file until `Ctrl + C`, even if the file is inaccessible:
`tail -F {{path/to/file}}`
* Show last 'count' lines in 'file' and refresh every 'seconds' seconds:
`tail -n {{8}} -s {{10}} -f {{path/to/file}}`"
What is ctags command,,"# ctags
> Generates an index (or tag) file of language objects found in source files
> for many popular programming languages. More information: https://ctags.io/.
* Generate tags for a single file, and output them to a file named ""tags"" in the current directory, overwriting the file if it exists:
`ctags {{path/to/file}}`
* Generate tags for all files in the current directory, and output them to a specific file, overwriting the file if it exists:
`ctags -f {{path/to/file}} *`
* Generate tags for all files in the current directory and all subdirectories:
`ctags --recurse`
* Generate tags for a single file, and output them with start line number and end line number in JSON format:
`ctags --fields=+ne --output-format=json {{path/to/file}}`"
What is mkdir command,,"# mkdir
> Create directories and set their permissions. More information:
> https://www.gnu.org/software/coreutils/mkdir.
* Create specific directories:
`mkdir {{path/to/directory1 path/to/directory2 ...}}`
* Create specific directories and their [p]arents if needed:
`mkdir -p {{path/to/directory1 path/to/directory2 ...}}`
* Create directories with specific permissions:
`mkdir -m {{rwxrw-r--}} {{path/to/directory1 path/to/directory2 ...}}`"
What is test command,,"# test
> Check file types and compare values. Returns 0 if the condition evaluates to
> true, 1 if it evaluates to false. More information:
> https://www.gnu.org/software/coreutils/test.
* Test if a given variable is equal to a given string:
`test ""{{$MY_VAR}}"" == ""{{/bin/zsh}}""`
* Test if a given variable is empty:
`test -z ""{{$GIT_BRANCH}}""`
* Test if a file exists:
`test -f ""{{path/to/file_or_directory}}""`
* Test if a directory does not exist:
`test ! -d ""{{path/to/directory}}""`
* If A is true, then do B, or C in the case of an error (notice that C may run even if A fails):
`test {{condition}} && {{echo ""true""}} || {{echo ""false""}}`"
What is uptime command,,"# uptime
> Tell how long the system has been running and other information. More
> information: https://ss64.com/osx/uptime.html.
* Print current time, uptime, number of logged-in users and other information:
`uptime`"
What is sha384sum command,,"# sha384sum
> Calculate SHA384 cryptographic checksums. More information:
> https://www.gnu.org/software/coreutils/manual/html_node/sha2-utilities.html.
* Calculate the SHA384 checksum for one or more files:
`sha384sum {{path/to/file1 path/to/file2 ...}}`
* Calculate and save the list of SHA384 checksums to a file:
`sha384sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha384}}`
* Calculate a SHA384 checksum from `stdin`:
`{{command}} | sha384sum`
* Read a file of SHA384 sums and filenames and verify all files have matching checksums:
`sha384sum --check {{path/to/file.sha384}}`
* Only show a message for missing files or when verification fails:
`sha384sum --check --quiet {{path/to/file.sha384}}`
* Only show a message when verification fails, ignoring missing files:
`sha384sum --ignore-missing --check --quiet {{path/to/file.sha384}}`"
What is file command,,"# file
> Determine file type. More information: https://manned.org/file.
* Give a description of the type of the specified file. Works fine for files with no file extension:
`file {{path/to/file}}`
* Look inside a zipped file and determine the file type(s) inside:
`file -z {{foo.zip}}`
* Allow file to work with special or device files:
`file -s {{path/to/file}}`
* Don't stop at first file type match; keep going until the end of the file:
`file -k {{path/to/file}}`
* Determine the MIME encoding type of a file:
`file -i {{path/to/file}}`"
What is rm command,,"# rm
> Remove files or directories. See also: `rmdir`. More information:
> https://www.gnu.org/software/coreutils/rm.
* Remove specific files:
`rm {{path/to/file1 path/to/file2 ...}}`
* Remove specific files ignoring nonexistent ones:
`rm -f {{path/to/file1 path/to/file2 ...}}`
* Remove specific files [i]nteractively prompting before each removal:
`rm -i {{path/to/file1 path/to/file2 ...}}`
* Remove specific files printing info about each removal:
`rm -v {{path/to/file1 path/to/file2 ...}}`
* Remove specific files and directories [r]ecursively:
`rm -r {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`"
What is git-update-ref command,,"# git update-ref
> Git command for creating, updating, and deleting Git refs. More information:
> https://git-scm.com/docs/git-update-ref.
* Delete a ref, useful for soft resetting the first commit:
`git update-ref -d {{HEAD}}`
* Update ref with a message:
`git update-ref -m {{message}} {{HEAD}} {{4e95e05}}`"
What is localectl command,,"# localectl
> Control the system locale and keyboard layout settings. More information:
> https://www.freedesktop.org/software/systemd/man/localectl.html.
* Show the current settings of the system locale and keyboard mapping:
`localectl`
* List available locales:
`localectl list-locales`
* Set a system locale variable:
`localectl set-locale {{LANG}}={{en_US.UTF-8}}`
* List available keymaps:
`localectl list-keymaps`
* Set the system keyboard mapping for the console and X11:
`localectl set-keymap {{us}}`"
What is cat command,,"# cat
> Print and concatenate files. More information:
> https://keith.github.io/xcode-man-pages/cat.1.html.
* Print the contents of a file to `stdout`:
`cat {{path/to/file}}`
* Concatenate several files into an output file:
`cat {{path/to/file1 path/to/file2 ...}} > {{path/to/output_file}}`
* Append several files to an output file:
`cat {{path/to/file1 path/to/file2 ...}} >> {{path/to/output_file}}`
* Copy the contents of a file into an output file without buffering:
`cat -u {{/dev/tty12}} > {{/dev/tty13}}`
* Write `stdin` to a file:
`cat - > {{path/to/file}}`
* Number all output lines:
`cat -n {{path/to/file}}`
* Display non-printable and whitespace characters (with `M-` prefix if non-ASCII):
`cat -v -t -e {{path/to/file}}`"
What is fc command,,"# fc
> Open the most recent command and edit it. More information:
> https://manned.org/fc.
* Open in the default system editor:
`fc`
* Specify an editor to open with:
`fc -e {{'emacs'}}`
* List recent commands from history:
`fc -l`
* List recent commands in reverse order:
`fc -l -r`
* List commands in a given interval:
`fc '{{416}}' '{{420}}'`"
What is sum command,,"# sum
> Compute checksums and the number of blocks for a file. A predecessor to the
> more modern `cksum`. More information:
> https://www.gnu.org/software/coreutils/sum.
* Compute a checksum with BSD-compatible algorithm and 1024-byte blocks:
`sum {{path/to/file}}`
* Compute a checksum with System V-compatible algorithm and 512-byte blocks:
`sum --sysv {{path/to/file}}`"
What is sha256sum command,,"# sha256sum
> Calculate SHA256 cryptographic checksums. More information:
> https://www.gnu.org/software/coreutils/manual/html_node/sha2-utilities.html.
* Calculate the SHA256 checksum for one or more files:
`sha256sum {{path/to/file1 path/to/file2 ...}}`
* Calculate and save the list of SHA256 checksums to a file:
`sha256sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha256}}`
* Calculate a SHA256 checksum from `stdin`:
`{{command}} | sha256sum`
* Read a file of SHA256 sums and filenames and verify all files have matching checksums:
`sha256sum --check {{path/to/file.sha256}}`
* Only show a message for missing files or when verification fails:
`sha256sum --check --quiet {{path/to/file.sha256}}`
* Only show a message when verification fails, ignoring missing files:
`sha256sum --ignore-missing --check --quiet {{path/to/file.sha256}}`"
What is runcon command,,"# runcon
> Run a program in a different SELinux security context. With neither context
> nor command, print the current security context. More information:
> https://www.gnu.org/software/coreutils/runcon.
* Determine the current domain:
`runcon`
* Specify the domain to run a command in:
`runcon -t {{domain}}_t {{command}}`
* Specify the context role to run a command with:
`runcon -r {{role}}_r {{command}}`
* Specify the full context to run a command with:
`runcon {{user}}_u:{{role}}_r:{{domain}}_t {{command}}`"
What is curl command,,"# curl
> Transfers data from or to a server. Supports most protocols, including HTTP,
> FTP, and POP3. More information: https://curl.se/docs/manpage.html.
* Download the contents of a URL to a file:
`curl {{http://example.com}} --output {{path/to/file}}`
* Download a file, saving the output under the filename indicated by the URL:
`curl --remote-name {{http://example.com/filename}}`
* Download a file, following location redirects, and automatically continuing (resuming) a previous file transfer and return an error on server error:
`curl --fail --remote-name --location --continue-at -
{{http://example.com/filename}}`
* Send form-encoded data (POST request of type `application/x-www-form-urlencoded`). Use `--data @file_name` or `--data @'-'` to read from STDIN:
`curl --data {{'name=bob'}} {{http://example.com/form}}`
* Send a request with an extra header, using a custom HTTP method:
`curl --header {{'X-My-Header: 123'}} --request {{PUT}}
{{http://example.com}}`
* Send data in JSON format, specifying the appropriate content-type header:
`curl --data {{'{""name"":""bob""}'}} --header {{'Content-Type:
application/json'}} {{http://example.com/users/1234}}`
* Pass a username and password for server authentication:
`curl --user myusername:mypassword {{http://example.com}}`
* Pass client certificate and key for a resource, skipping certificate validation:
`curl --cert {{client.pem}} --key {{key.pem}} --insecure
{{https://example.com}}`"
What is git-verify-commit command,,"# git verify-commit
> Check for GPG verification of commits. If no commits are verified, nothing
> will be printed, regardless of options specified. More information:
> https://git-scm.com/docs/git-verify-commit.
* Check commits for a GPG signature:
`git verify-commit {{commit_hash1 optional_commit_hash2 ...}}`
* Check commits for a GPG signature and show details of each commit:
`git verify-commit {{commit_hash1 optional_commit_hash2 ...}} --verbose`
* Check commits for a GPG signature and print the raw details:
`git verify-commit {{commit_hash1 optional_commit_hash2 ...}} --raw`"
What is rmdir command,,"# rmdir
> Remove directories without files. See also: `rm`. More information:
> https://www.gnu.org/software/coreutils/rmdir.
* Remove specific directories:
`rmdir {{path/to/directory1 path/to/directory2 ...}}`
* Remove specific nested directories recursively:
`rmdir -p {{path/to/directory1 path/to/directory2 ...}}`"
What is getfacl command,,"# getfacl
> Get file access control lists. More information: https://manned.org/getfacl.
* Display the file access control list:
`getfacl {{path/to/file_or_directory}}`
* Display the file access control list with numeric user and group IDs:
`getfacl -n {{path/to/file_or_directory}}`
* Display the file access control list with tabular output format:
`getfacl -t {{path/to/file_or_directory}}`"
What is nsenter command,,"# nsenter
> Run a new command in a running process' namespace. Particularly useful for
> docker images or chroot jails. More information: https://manned.org/nsenter.
* Run a specific command using the same namespaces as an existing process:
`nsenter --target {{pid}} --all {{command}} {{command_arguments}}`
* Run a specific command in an existing process's network namespace:
`nsenter --target {{pid}} --net {{command}} {{command_arguments}}`
* Run a specific command in an existing process's PID namespace:
`nsenter --target {{pid}} --pid {{command}} {{command_arguments}}`
* Run a specific command in an existing process's IPC namespace:
`nsenter --target {{pid}} --ipc {{command}} {{command_arguments}}`
* Run a specific command in an existing process's UTS, time, and IPC namespaces:
`nsenter --target {{pid}} --uts --time --ipc -- {{command}}
{{command_arguments}}`
* Run a specific command in an existing process's namespace by referencing procfs:
`nsenter --pid=/proc/{{pid}}/pid/net -- {{command}} {{command_arguments}}`"
What is rsync command,,"# rsync
> Transfer files either to or from a remote host (but not between two remote
> hosts), by default using SSH. To specify a remote path, use
> `host:path/to/file_or_directory`. More information:
> https://download.samba.org/pub/rsync/rsync.1.
* Transfer a file:
`rsync {{path/to/source}} {{path/to/destination}}`
* Use archive mode (recursively copy directories, copy symlinks without resolving and preserve permissions, ownership and modification times):
`rsync --archive {{path/to/source}} {{path/to/destination}}`
* Compress the data as it is sent to the destination, display verbose and human-readable progress, and keep partially transferred files if interrupted:
`rsync --compress --verbose --human-readable --partial --progress
{{path/to/source}} {{path/to/destination}}`
* Recursively copy directories:
`rsync --recursive {{path/to/source}} {{path/to/destination}}`
* Transfer directory contents, but not the directory itself:
`rsync --recursive {{path/to/source}}/ {{path/to/destination}}`
* Recursively copy directories, use archive mode, resolve symlinks and skip files that are newer on the destination:
`rsync --recursive --archive --update --copy-links {{path/to/source}}
{{path/to/destination}}`
* Transfer a directory to a remote host running `rsyncd` and delete files on the destination that do not exist on the source:
`rsync --recursive --delete rsync://{{host}}:{{path/to/source}}
{{path/to/destination}}`
* Transfer a file over SSH using a different port than the default (22) and show global progress:
`rsync --rsh 'ssh -p {{port}}' --info=progress2 {{host}}:{{path/to/source}}
{{path/to/destination}}`"
What is unexpand command,,"# unexpand
> Convert spaces to tabs. More information:
> https://www.gnu.org/software/coreutils/unexpand.
* Convert blanks in each file to tabs, writing to `stdout`:
`unexpand {{path/to/file}}`
* Convert blanks to tabs, reading from `stdout`:
`unexpand`
* Convert all blanks, instead of just initial blanks:
`unexpand -a {{path/to/file}}`
* Convert only leading sequences of blanks (overrides -a):
`unexpand --first-only {{path/to/file}}`
* Have tabs a certain number of characters apart, not 8 (enables -a):
`unexpand -t {{number}} {{path/to/file}}`"
What is scp command,,"# scp
> Secure copy. Copy files between hosts using Secure Copy Protocol over SSH.
> More information: https://man.openbsd.org/scp.
* Copy a local file to a remote host:
`scp {{path/to/local_file}} {{remote_host}}:{{path/to/remote_file}}`
* Use a specific port when connecting to the remote host:
`scp -P {{port}} {{path/to/local_file}}
{{remote_host}}:{{path/to/remote_file}}`
* Copy a file from a remote host to a local directory:
`scp {{remote_host}}:{{path/to/remote_file}} {{path/to/local_directory}}`
* Recursively copy the contents of a directory from a remote host to a local directory:
`scp -r {{remote_host}}:{{path/to/remote_directory}}
{{path/to/local_directory}}`
* Copy a file between two remote hosts transferring through the local host:
`scp -3 {{host1}}:{{path/to/remote_file}}
{{host2}}:{{path/to/remote_directory}}`
* Use a specific username when connecting to the remote host:
`scp {{path/to/local_file}}
{{remote_username}}@{{remote_host}}:{{path/to/remote_directory}}`
* Use a specific ssh private key for authentication with the remote host:
`scp -i {{~/.ssh/private_key}} {{local_file}}
{{remote_host}}:{{/path/remote_file}}`"
What is timedatectl command,,"# timedatectl
> Control the system time and date. More information:
> https://manned.org/timedatectl.
* Check the current system clock time:
`timedatectl`
* Set the local time of the system clock directly:
`timedatectl set-time ""{{yyyy-MM-dd hh:mm:ss}}""`
* List available timezones:
`timedatectl list-timezones`
* Set the system timezone:
`timedatectl set-timezone {{timezone}}`
* Enable Network Time Protocol (NTP) synchronization:
`timedatectl set-ntp on`
* Change the hardware clock time standard to localtime:
`timedatectl set-local-rtc 1`"
What is screen command,,"# screen
> Hold a session open on a remote server. Manage multiple windows with a
> single SSH connection. See also `tmux` and `zellij`. More information:
> https://manned.org/screen.
* Start a new screen session:
`screen`
* Start a new named screen session:
`screen -S {{session_name}}`
* Start a new daemon and log the output to `screenlog.x`:
`screen -dmLS {{session_name}} {{command}}`
* Show open screen sessions:
`screen -ls`
* Reattach to an open screen:
`screen -r {{session_name}}`
* Detach from inside a screen:
`Ctrl + A, D`
* Kill the current screen session:
`Ctrl + A, K`
* Kill a detached screen:
`screen -X -S {{session_name}} quit`"
What is write command,,"# write
> Write a message on the terminal of a specified logged in user (ctrl-C to
> stop writing messages). Use the `who` command to find out all terminal_ids
> of all active users active on the system. See also `mesg`. More information:
> https://manned.org/write.
* Send a message to a given user on a given terminal id:
`write {{username}} {{terminal_id}}`
* Send message to ""testuser"" on terminal `/dev/tty/5`:
`write {{testuser}} {{tty/5}}`
* Send message to ""johndoe"" on pseudo terminal `/dev/pts/5`:
`write {{johndoe}} {{pts/5}}`"
What is as command,,"# as
> Portable GNU assembler. Primarily intended to assemble output from `gcc` to
> be used by `ld`. More information: https://www.unix.com/man-page/osx/1/as/.
* Assemble a file, writing the output to `a.out`:
`as {{path/to/file.s}}`
* Assemble the output to a given file:
`as {{path/to/file.s}} -o {{path/to/output_file.o}}`
* Generate output faster by skipping whitespace and comment preprocessing. (Should only be used for trusted compilers):
`as -f {{path/to/file.s}}`
* Include a given path to the list of directories to search for files specified in `.include` directives:
`as -I {{path/to/directory}} {{path/to/file.s}}`"
What is systemd-cat command,,"# systemd-cat
> Connect a pipeline or program's output streams with the systemd journal.
> More information: https://www.freedesktop.org/software/systemd/man/systemd-
> cat.html.
* Write the output of the specified command to the journal (both output streams are captured):
`systemd-cat {{command}}`
* Write the output of a pipeline to the journal (`stderr` stays connected to the terminal):
`{{command}} | systemd-cat`"
What is git-rev-parse command,,"# git rev-parse
> Display metadata related to specific revisions. More information:
> https://git-scm.com/docs/git-rev-parse.
* Get the commit hash of a branch:
`git rev-parse {{branch_name}}`
* Get the current branch name:
`git rev-parse --abbrev-ref {{HEAD}}`
* Get the absolute path to the root directory:
`git rev-parse --show-toplevel`"
What is patch command,,"# patch
> Patch a file (or files) with a diff file. Note that diff files should be
> generated by the `diff` command. More information: https://manned.org/patch.
* Apply a patch using a diff file (filenames must be included in the diff file):
`patch < {{patch.diff}}`
* Apply a patch to a specific file:
`patch {{path/to/file}} < {{patch.diff}}`
* Patch a file writing the result to a different file:
`patch {{path/to/input_file}} -o {{path/to/output_file}} < {{patch.diff}}`
* Apply a patch to the current directory:
`patch -p1 < {{patch.diff}}`
* Apply the reverse of a patch:
`patch -R < {{patch.diff}}`"
What is size command,,"# size
> Displays the sizes of sections inside binary files. More information:
> https://sourceware.org/binutils/docs/binutils/size.html.
* Display the size of sections in a given object or executable file:
`size {{path/to/file}}`
* Display the size of sections in a given object or executable file in [o]ctal:
`size {{-o|--radix=8}} {{path/to/file}}`
* Display the size of sections in a given object or executable file in [d]ecimal:
`size {{-d|--radix=10}} {{path/to/file}}`
* Display the size of sections in a given object or executable file in he[x]adecimal:
`size {{-x|--radix=16}} {{path/to/file}}`"
What is column command,,"# column
> Format `stdin` or a file into multiple columns. Columns are filled before
> rows; the default separator is a whitespace. More information:
> https://manned.org/column.
* Format the output of a command for a 30 characters wide display:
`printf ""header1 header2\nbar foo\n"" | column --output-width {{30}}`
* Split columns automatically and auto-align them in a tabular format:
`printf ""header1 header2\nbar foo\n"" | column --table`
* Specify the column delimiter character for the `--table` option (e.g. "","" for CSV) (defaults to whitespace):
`printf ""header1,header2\nbar,foo\n"" | column --table --separator {{,}}`
* Fill rows before filling columns:
`printf ""header1\nbar\nfoobar\n"" | column --output-width {{30}} --fillrows`"
What is seq command,,"# seq
> Output a sequence of numbers to `stdout`. More information:
> https://www.gnu.org/software/coreutils/seq.
* Sequence from 1 to 10:
`seq 10`
* Every 3rd number from 5 to 20:
`seq 5 3 20`
* Separate the output with a space instead of a newline:
`seq -s "" "" 5 3 20`
* Format output width to a minimum of 4 digits padding with zeros as necessary:
`seq -f ""%04g"" 5 3 20`"
What is fmt command,,"# fmt
> Reformat a text file by joining its paragraphs and limiting the line width
> to given number of characters (75 by default). More information:
> https://www.gnu.org/software/coreutils/fmt.
* Reformat a file:
`fmt {{path/to/file}}`
* Reformat a file producing output lines of (at most) `n` characters:
`fmt -w {{n}} {{path/to/file}}`
* Reformat a file without joining lines shorter than the given width together:
`fmt -s {{path/to/file}}`
* Reformat a file with uniform spacing (1 space between words and 2 spaces between paragraphs):
`fmt -u {{path/to/file}}`"
What is groups command,,"# groups
> Print group memberships for a user. See also: `groupadd`, `groupdel`,
> `groupmod`. More information: https://www.gnu.org/software/coreutils/groups.
* Print group memberships for the current user:
`groups`
* Print group memberships for a list of users:
`groups {{username1 username2 ...}}`"
What is nm command,,"# nm
> List symbol names in object files. More information: https://manned.org/nm.
* List global (extern) functions in a file (prefixed with T):
`nm -g {{path/to/file.o}}`
* List only undefined symbols in a file:
`nm -u {{path/to/file.o}}`
* List all symbols, even debugging symbols:
`nm -a {{path/to/file.o}}`
* Demangle C++ symbols (make them readable):
`nm --demangle {{path/to/file.o}}`"
What is git-stage command,,"# git stage
> Add file contents to the staging area. Synonym of `git add`. More
> information: https://git-scm.com/docs/git-stage.
* Add a file to the index:
`git stage {{path/to/file}}`
* Add all files (tracked and untracked):
`git stage -A`
* Only add already tracked files:
`git stage -u`
* Also add ignored files:
`git stage -f`
* Interactively stage parts of files:
`git stage -p`
* Interactively stage parts of a given file:
`git stage -p {{path/to/file}}`
* Interactively stage a file:
`git stage -i`"
What is dd command,,"# dd
> Convert and copy a file. More information: https://keith.github.io/xcode-
> man-pages/dd.1.html.
* Make a bootable USB drive from an isohybrid file (such like `archlinux-xxx.iso`) and show the progress:
`dd if={{path/to/file.iso}} of={{/dev/usb_device}} status=progress`
* Clone a drive to another drive with 4 MB block, ignore error and show the progress:
`dd if={{/dev/source_device}} of={{/dev/dest_device}} bs={{4m}}
conv={{noerror}} status=progress`
* Generate a file of 100 random bytes by using kernel random driver:
`dd if=/dev/urandom of={{path/to/random_file}} bs={{100}} count={{1}}`
* Benchmark the write performance of a disk:
`dd if=/dev/zero of={{path/to/1GB_file}} bs={{1024}} count={{1000000}}`
* Generate a system backup into an IMG file and show the progress:
`dd if=/dev/{{drive_device}} of={{path/to/file.img}} status=progress`
* Restore a drive from an IMG file and show the progress:
`dd if={{path/to/file.img}} of={{/dev/drive_device}} status=progress`
* Check the progress of an ongoing dd operation (run this command from another shell):
`kill -USR1 $(pgrep ^dd)`"
What is prlimit command,,"# prlimit
> Get or set process resource soft and hard limits. Given a process ID and one
> or more resources, prlimit tries to retrieve and/or modify the limits. More
> information: https://manned.org/prlimit.
* Display limit values for all current resources for the running parent process:
`prlimit`
* Display limit values for all current resources of a specified process:
`prlimit --pid {{pid number}}`
* Run a command with a custom number of open files limit:
`prlimit --nofile={{10}} {{command}}`"
What is uniq command,,"# uniq
> Output the unique lines from the given input or file. Since it does not
> detect repeated lines unless they are adjacent, we need to sort them first.
> More information: https://www.gnu.org/software/coreutils/uniq.
* Display each line once:
`sort {{path/to/file}} | uniq`
* Display only unique lines:
`sort {{path/to/file}} | uniq -u`
* Display only duplicate lines:
`sort {{path/to/file}} | uniq -d`
* Display number of occurrences of each line along with that line:
`sort {{path/to/file}} | uniq -c`
* Display number of occurrences of each line, sorted by the most frequent:
`sort {{path/to/file}} | uniq -c | sort -nr`"
What is git-remote command,,"# git remote
> Manage set of tracked repositories (""remotes""). More information:
> https://git-scm.com/docs/git-remote.
* Show a list of existing remotes, their names and URL:
`git remote -v`
* Show information about a remote:
`git remote show {{remote_name}}`
* Add a remote:
`git remote add {{remote_name}} {{remote_url}}`
* Change the URL of a remote (use `--add` to keep the existing URL):
`git remote set-url {{remote_name}} {{new_url}}`
* Show the URL of a remote:
`git remote get-url {{remote_name}}`
* Remove a remote:
`git remote remove {{remote_name}}`
* Rename a remote:
`git remote rename {{old_name}} {{new_name}}`"
What is systemd-path command,,"# systemd-path
> List and query system and user paths. More information:
> https://www.freedesktop.org/software/systemd/man/systemd-path.html.
* Display a list of known paths and their current values:
`systemd-path`
* Query the specified path and display its value:
`systemd-path ""{{path_name}}""`
* Suffix printed paths with `suffix_string`:
`systemd-path --suffix {{suffix_string}}`
* Print a short version string and then exit:
`systemd-path --version`"
What is whatis command,,"# whatis
> Tool that searches a set of database files containing short descriptions of
> system commands for keywords. More information:
> http://www.linfo.org/whatis.html.
* Search for information about keyword:
`whatis {{keyword}}`
* Search for information about multiple keywords:
`whatis {{keyword1}} {{keyword2}}`"
What is git-grep command,,"# git-grep
> Find strings inside files anywhere in a repository's history. Accepts a lot
> of the same flags as regular `grep`. More information: https://git-
> scm.com/docs/git-grep.
* Search for a string in tracked files:
`git grep {{search_string}}`
* Search for a string in files matching a pattern in tracked files:
`git grep {{search_string}} -- {{file_glob_pattern}}`
* Search for a string in tracked files, including submodules:
`git grep --recurse-submodules {{search_string}}`
* Search for a string at a specific point in history:
`git grep {{search_string}} {{HEAD~2}}`
* Search for a string across all branches:
`git grep {{search_string}} $(git rev-list --all)`"
What is touch command,,"# touch
> Create files and set access/modification times. More information:
> https://manned.org/man/freebsd-13.1/touch.
* Create specific files:
`touch {{path/to/file1 path/to/file2 ...}}`
* Set the file [a]ccess or [m]odification times to the current one and don't [c]reate file if it doesn't exist:
`touch -c -{{a|m}} {{path/to/file1 path/to/file2 ...}}`
* Set the file [t]ime to a specific value and don't [c]reate file if it doesn't exist:
`touch -c -t {{YYYYMMDDHHMM.SS}} {{path/to/file1 path/to/file2 ...}}`
* Set the file time of a specific file to the time of anothe[r] file and don't [c]reate file if it doesn't exist:
`touch -c -r {{~/.emacs}} {{path/to/file1 path/to/file2 ...}}`"
What is vdir command,,"# vdir
> List directory contents. Drop-in replacement for `ls -l`. More information:
> https://www.gnu.org/software/coreutils/vdir.
* List files and directories in the current directory, one per line, with details:
`vdir`
* List with sizes displayed in human-readable units (KB, MB, GB):
`vdir -h`
* List including hidden files (starting with a dot):
`vdir -a`
* List files and directories sorting entries by size (largest first):
`vdir -S`
* List files and directories sorting entries by modification time (newest first):
`vdir -t`
* List grouping directories first:
`vdir --group-directories-first`
* Recursively list all files and directories in a specific directory:
`vdir --recursive {{path/to/directory}}`"
What is pmap command,,"# pmap
> Report memory map of a process or processes. More information:
> https://manned.org/pmap.
* Print memory map for a specific process id (PID):
`pmap {{pid}}`
* Show the extended format:
`pmap --extended {{pid}}`
* Show the device format:
`pmap --device {{pid}}`
* Limit results to a memory address range specified by `low` and `high`:
`pmap --range {{low}},{{high}}`
* Print memory maps for multiple processes:
`pmap {{pid1 pid2 ...}}`"
What is killall command,,"# killall
> Send kill signal to all instances of a process by name (must be exact name).
> All signals except SIGKILL and SIGSTOP can be intercepted by the process,
> allowing a clean exit. More information: https://manned.org/killall.
* Terminate a process using the default SIGTERM (terminate) signal:
`killall {{process_name}}`
* [l]ist available signal names (to be used without the 'SIG' prefix):
`killall -l`
* Interactively ask for confirmation before termination:
`killall -i {{process_name}}`
* Terminate a process using the SIGINT (interrupt) signal, which is the same signal sent by pressing `Ctrl + C`:
`killall -INT {{process_name}}`
* Force kill a process:
`killall -KILL {{process_name}}`"
What is who command,,"# who
> Display who is logged in and related data (processes, boot time). More
> information: https://www.gnu.org/software/coreutils/who.
* Display the username, line, and time of all currently logged-in sessions:
`who`
* Display information only for the current terminal session:
`who am i`
* Display all available information:
`who -a`
* Display all available information with table headers:
`who -a -H`"
What is mesg command,,"# mesg
> Check or set a terminal's ability to receive messages from other users,
> usually from the write command. See also `write`. More information:
> https://manned.org/mesg.
* Check terminal's openness to write messages:
`mesg`
* Disable receiving messages from the write command:
`mesg n`
* Enable receiving messages from the write command:
`mesg y`"
What is gcov command,,"# gcov
> Code coverage analysis and profiling tool that discovers untested parts of a
> program. Also displays a copy of source code annotated with execution
> frequencies of code segments. More information:
> https://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html.
* Generate a coverage report named `file.cpp.gcov`:
`gcov {{path/to/file.cpp}}`
* Write individual execution counts for every basic block:
`gcov --all-blocks {{path/to/file.cpp}}`
* Write branch frequencies to the output file and print summary information to `stdout` as a percentage:
`gcov --branch-probabilities {{path/to/file.cpp}}`
* Write branch frequencies as the number of branches taken, rather than the percentage:
`gcov --branch-counts {{path/to/file.cpp}}`
* Do not create a `gcov` output file:
`gcov --no-output {{path/to/file.cpp}}`
* Write file level as well as function level summaries:
`gcov --function-summaries {{path/to/file.cpp}}`"
What is ltrace command,,"# ltrace
> Display dynamic library calls of a process. More information:
> https://manned.org/ltrace.
* Print (trace) library calls of a program binary:
`ltrace ./{{program}}`
* Count library calls. Print a handy summary at the bottom:
`ltrace -c {{path/to/program}}`
* Trace calls to malloc and free, omit those done by libc:
`ltrace -e malloc+free-@libc.so* {{path/to/program}}`
* Write to file instead of terminal:
`ltrace -o {{file}} {{path/to/program}}`"
What is awk command,,"# awk
> A versatile programming language for working on files. More information:
> https://github.com/onetrueawk/awk.
* Print the fifth column (a.k.a. field) in a space-separated file:
`awk '{print $5}' {{path/to/file}}`
* Print the second column of the lines containing ""foo"" in a space-separated file:
`awk '/{{foo}}/ {print $2}' {{path/to/file}}`
* Print the last column of each line in a file, using a comma (instead of space) as a field separator:
`awk -F ',' '{print $NF}' {{path/to/file}}`
* Sum the values in the first column of a file and print the total:
`awk '{s+=$1} END {print s}' {{path/to/file}}`
* Print every third line starting from the first line:
`awk 'NR%3==1' {{path/to/file}}`
* Print different values based on conditions:
`awk '{if ($1 == ""foo"") print ""Exact match foo""; else if ($1 ~ ""bar"") print
""Partial match bar""; else print ""Baz""}' {{path/to/file}}`
* Print all lines where the 10th column value equals the specified value:
`awk '($10 == value)'`
* Print all the lines which the 10th column value is between a min and a max:
`awk '($10 >= min_value && $10 <= max_value)'`"
What is git-cherry-pick command,,"# git cherry-pick
> Apply the changes introduced by existing commits to the current branch. To
> apply changes to another branch, first use `git checkout` to switch to the
> desired branch. More information: https://git-scm.com/docs/git-cherry-pick.
* Apply a commit to the current branch:
`git cherry-pick {{commit}}`
* Apply a range of commits to the current branch (see also `git rebase --onto`):
`git cherry-pick {{start_commit}}~..{{end_commit}}`
* Apply multiple (non-sequential) commits to the current branch:
`git cherry-pick {{commit_1}} {{commit_2}}`
* Add the changes of a commit to the working directory, without creating a commit:
`git cherry-pick --no-commit {{commit}}`"
What is login command,,"# login
> Initiates a session for a user. More information: https://manned.org/login.
* Log in as a user:
`login {{user}}`
* Log in as user without authentication if user is preauthenticated:
`login -f {{user}}`
* Log in as user and preserve environment:
`login -p {{user}}`
* Log in as a user on a remote host:
`login -h {{host}} {{user}}`"
What is git-branch command,,"# git branch
> Main Git command for working with branches. More information: https://git-
> scm.com/docs/git-branch.
* List all branches (local and remote; the current branch is highlighted by `*`):
`git branch --all`
* List which branches include a specific Git commit in their history:
`git branch --all --contains {{commit_hash}}`
* Show the name of the current branch:
`git branch --show-current`
* Create new branch based on the current commit:
`git branch {{branch_name}}`
* Create new branch based on a specific commit:
`git branch {{branch_name}} {{commit_hash}}`
* Rename a branch (must not have it checked out to do this):
`git branch -m {{old_branch_name}} {{new_branch_name}}`
* Delete a local branch (must not have it checked out to do this):
`git branch -d {{branch_name}}`
* Delete a remote branch:
`git push {{remote_name}} --delete {{remote_branch_name}}`"
What is base64 command,,"# base64
> Encode and decode using Base64 representation. More information:
> https://www.unix.com/man-page/osx/1/base64/.
* Encode a file:
`base64 --input={{plain_file}}`
* Decode a file:
`base64 --decode --input={{base64_file}}`
* Encode from `stdin`:
`echo -n ""{{plain_text}}"" | base64`
* Decode from `stdin`:
`echo -n {{base64_text}} | base64 --decode`"
What is ipcs command,,"# ipcs
> Display information about resources used in IPC (Inter-process
> Communication). More information: https://manned.org/ipcs.
* Specific information about the Message Queue which has the ID 32768:
`ipcs -qi 32768`
* General information about all the IPC:
`ipcs -a`"
What is type command,,"# type
> Display the type of command the shell will execute. More information:
> https://manned.org/type.
* Display the type of a command:
`type {{command}}`
* Display all locations containing the specified executable:
`type -a {{command}}`
* Display the name of the disk file that would be executed:
`type -p {{command}}`"
What is ul command,,"# ul
> Performs the underlining of a text. Each character in a given string must be
> underlined separately. More information: https://manned.org/ul.
* Display the contents of the file with underlines where applicable:
`ul {{file.txt}}`
* Display the contents of the file with underlines made of dashes `-`:
`ul -i {{file.txt}}`"
What is ldd command,,"# ldd
> Display shared library dependencies of a binary. Do not use on an untrusted
> binary, use objdump for that instead. More information:
> https://manned.org/ldd.
* Display shared library dependencies of a binary:
`ldd {{path/to/binary}}`
* Display all information about dependencies:
`ldd --verbose {{path/to/binary}}`
* Display unused direct dependencies:
`ldd --unused {{path/to/binary}}`
* Report missing data objects and perform data relocations:
`ldd --data-relocs {{path/to/binary}}`
* Report missing data objects and functions, and perform relocations for both:
`ldd --function-relocs {{path/to/binary}}`"
What is git-gc command,,"# git gc
> Optimise the local repository by cleaning unnecessary files. More
> information: https://git-scm.com/docs/git-gc.
* Optimise the repository:
`git gc`
* Aggressively optimise, takes more time:
`git gc --aggressive`
* Do not prune loose objects (prunes by default):
`git gc --no-prune`
* Suppress all output:
`git gc --quiet`
* View full usage:
`git gc --help`"
What is git-diff command,,"# git diff
> Show changes to tracked files. More information: https://git-
> scm.com/docs/git-diff.
* Show unstaged, uncommitted changes:
`git diff`
* Show all uncommitted changes (including staged ones):
`git diff HEAD`
* Show only staged (added, but not yet committed) changes:
`git diff --staged`
* Show changes from all commits since a given date/time (a date expression, e.g. ""1 week 2 days"" or an ISO date):
`git diff 'HEAD@{3 months|weeks|days|hours|seconds ago}'`
* Show only names of changed files since a given commit:
`git diff --name-only {{commit}}`
* Output a summary of file creations, renames and mode changes since a given commit:
`git diff --summary {{commit}}`
* Compare a single file between two branches or commits:
`git diff {{branch_1}}..{{branch_2}} [--] {{path/to/file}}`
* Compare different files from the current branch to other branch:
`git diff {{branch}}:{{path/to/file2}} {{path/to/file}}`"
What is unexpand command,,"# unexpand
> Convert spaces to tabs. More information:
> https://www.gnu.org/software/coreutils/unexpand.
* Convert blanks in each file to tabs, writing to `stdout`:
`unexpand {{path/to/file}}`
* Convert blanks to tabs, reading from `stdout`:
`unexpand`
* Convert all blanks, instead of just initial blanks:
`unexpand -a {{path/to/file}}`
* Convert only leading sequences of blanks (overrides -a):
`unexpand --first-only {{path/to/file}}`
* Have tabs a certain number of characters apart, not 8 (enables -a):
`unexpand -t {{number}} {{path/to/file}}`"
What is unlink command,,"# unlink
> Remove a link to a file from the filesystem. The file contents is lost if
> the link is the last one to the file. More information:
> https://www.gnu.org/software/coreutils/unlink.
* Remove the specified file if it is the last link:
`unlink {{path/to/file}}`"
What is ls command,,"# ls
> List directory contents. More information:
> https://www.gnu.org/software/coreutils/ls.
* List files one per line:
`ls -1`
* List all files, including hidden files:
`ls -a`
* List all files, with trailing `/` added to directory names:
`ls -F`
* Long format list (permissions, ownership, size, and modification date) of all files:
`ls -la`
* Long format list with size displayed using human-readable units (KiB, MiB, GiB):
`ls -lh`
* Long format list sorted by size (descending):
`ls -lS`
* Long format list of all files, sorted by modification date (oldest first):
`ls -ltr`
* Only list directories:
`ls -d */`"
What is renice command,,"# renice
> Alters the scheduling priority/niceness of one or more running processes.
> Niceness values range from -20 (most favorable to the process) to 19 (least
> favorable to the process). More information: https://manned.org/renice.
* Change priority of a running process:
`renice -n {{niceness_value}} -p {{pid}}`
* Change priority of all processes owned by a user:
`renice -n {{niceness_value}} -u {{user}}`
* Change priority of all processes that belong to a process group:
`renice -n {{niceness_value}} --pgrp {{process_group}}`"
What is groups command,,"# groups
> Print group memberships for a user. See also: `groupadd`, `groupdel`,
> `groupmod`. More information: https://www.gnu.org/software/coreutils/groups.
* Print group memberships for the current user:
`groups`
* Print group memberships for a list of users:
`groups {{username1 username2 ...}}`"
What is comm command,,"# comm
> Select or reject lines common to two files. Both files must be sorted. More
> information: https://www.gnu.org/software/coreutils/comm.
* Produce three tab-separated columns: lines only in first file, lines only in second file and common lines:
`comm {{file1}} {{file2}}`
* Print only lines common to both files:
`comm -12 {{file1}} {{file2}}`
* Print only lines common to both files, reading one file from `stdin`:
`cat {{file1}} | comm -12 - {{file2}}`
* Get lines only found in first file, saving the result to a third file:
`comm -23 {{file1}} {{file2}} > {{file1_only}}`
* Print lines only found in second file, when the files aren't sorted:
`comm -13 <(sort {{file1}}) <(sort {{file2}})`"
What is iostat command,,"# iostat
> Report statistics for devices and partitions. More information:
> https://manned.org/iostat.
* Display a report of CPU and disk statistics since system startup:
`iostat`
* Display a report of CPU and disk statistics with units converted to megabytes:
`iostat -m`
* Display CPU statistics:
`iostat -c`
* Display disk statistics with disk names (including LVM):
`iostat -N`
* Display extended disk statistics with disk names for device ""sda"":
`iostat -xN {{sda}}`
* Display incremental reports of CPU and disk statistics every 2 seconds:
`iostat {{2}}`"
What is pathchk command,,"# pathchk
> Check the validity and portability of one or more pathnames. More
> information: https://www.gnu.org/software/coreutils/pathchk.
* Check pathnames for validity in the current system:
`pathchk {{path1 path2 …}}`
* Check pathnames for validity on a wider range of POSIX compliant systems:
`pathchk -p {{path1 path2 …}}`
* Check pathnames for validity on all POSIX compliant systems:
`pathchk --portability {{path1 path2 …}}`
* Only check for empty pathnames or leading dashes (-):
`pathchk -P {{path1 path2 …}}`"
What is git-tag command,,"# git tag
> Create, list, delete or verify tags. A tag is a static reference to a
> specific commit. More information: https://git-scm.com/docs/git-tag.
* List all tags:
`git tag`
* Create a tag with the given name pointing to the current commit:
`git tag {{tag_name}}`
* Create a tag with the given name pointing to a given commit:
`git tag {{tag_name}} {{commit}}`
* Create an annotated tag with the given message:
`git tag {{tag_name}} -m {{tag_message}}`
* Delete the tag with the given name:
`git tag -d {{tag_name}}`
* Get updated tags from upstream:
`git fetch --tags`
* List all tags whose ancestors include a given commit:
`git tag --contains {{commit}}`"
What is last command,,"# last
> View the last logged in users. More information: https://manned.org/last.
* View last logins, their duration and other information as read from `/var/log/wtmp`:
`last`
* Specify how many of the last logins to show:
`last -n {{login_count}}`
* Print the full date and time for entries and then display the hostname column last to prevent truncation:
`last -F -a`
* View all logins by a specific user and show the IP address instead of the hostname:
`last {{username}} -i`
* View all recorded reboots (i.e., the last logins of the pseudo user ""reboot""):
`last reboot`
* View all recorded shutdowns (i.e., the last logins of the pseudo user ""shutdown""):
`last shutdown`"
What is git-fetch command,,"# git fetch
> Download objects and refs from a remote repository. More information:
> https://git-scm.com/docs/git-fetch.
* Fetch the latest changes from the default remote upstream repository (if set):
`git fetch`
* Fetch new branches from a specific remote upstream repository:
`git fetch {{remote_name}}`
* Fetch the latest changes from all remote upstream repositories:
`git fetch --all`
* Also fetch tags from the remote upstream repository:
`git fetch --tags`
* Delete local references to remote branches that have been deleted upstream:
`git fetch --prune`"
What is xargs command,,"# xargs
> Execute a command with piped arguments coming from another command, a file,
> etc. The input is treated as a single block of text and split into separate
> pieces on spaces, tabs, newlines and end-of-file. More information:
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html.
* Run a command using the input data as arguments:
`{{arguments_source}} | xargs {{command}}`
* Run multiple chained commands on the input data:
`{{arguments_source}} | xargs sh -c ""{{command1}} && {{command2}} |
{{command3}}""`
* Delete all files with a `.backup` extension (`-print0` uses a null character to split file names, and `-0` uses it as delimiter):
`find . -name {{'*.backup'}} -print0 | xargs -0 rm -v`
* Execute the command once for each input line, replacing any occurrences of the placeholder (here marked as `_`) with the input line:
`{{arguments_source}} | xargs -I _ {{command}} _ {{optional_extra_arguments}}`
* Parallel runs of up to `max-procs` processes at a time; the default is 1. If `max-procs` is 0, xargs will run as many processes as possible at a time:
`{{arguments_source}} | xargs -P {{max-procs}} {{command}}`"
What is jobs command,,"# jobs
> Display status of jobs in the current session. More information:
> https://manned.org/jobs.
* Show status of all jobs:
`jobs`
* Show status of a particular job:
`jobs %{{job_id}}`
* Show status and process IDs of all jobs:
`jobs -l`
* Show process IDs of all jobs:
`jobs -p`"
What is objdump command,,"# objdump
> View information about object files. More information:
> https://manned.org/objdump.
* Display the file header information:
`objdump -f {{binary}}`
* Display the disassembled output of executable sections:
`objdump -d {{binary}}`
* Display the disassembled executable sections in intel syntax:
`objdump -M intel -d {{binary}}`
* Display a complete binary hex dump of all sections:
`objdump -s {{binary}}`"
What is git-worktree command,,"# git worktree
> Manage multiple working trees attached to the same repository. More
> information: https://git-scm.com/docs/git-worktree.
* Create a new directory with the specified branch checked out into it:
`git worktree add {{path/to/directory}} {{branch}}`
* Create a new directory with a new branch checked out into it:
`git worktree add {{path/to/directory}} -b {{new_branch}}`
* List all the working directories attached to this repository:
`git worktree list`
* Remove a worktree (after deleting worktree directory):
`git worktree prune`"
What is tee command,,"# tee
> Read from `stdin` and write to `stdout` and files (or commands). More
> information: https://www.gnu.org/software/coreutils/tee.
* Copy `stdin` to each file, and also to `stdout`:
`echo ""example"" | tee {{path/to/file}}`
* Append to the given files, do not overwrite:
`echo ""example"" | tee -a {{path/to/file}}`
* Print `stdin` to the terminal, and also pipe it into another program for further processing:
`echo ""example"" | tee {{/dev/tty}} | {{xargs printf ""[%s]""}}`
* Create a directory called ""example"", count the number of characters in ""example"" and write ""example"" to the terminal:
`echo ""example"" | tee >(xargs mkdir) >(wc -c)`"
What is git-cvsexportcommit command,,"# git cvsexportcommit
> Export a single `Git` commit to a CVS checkout. More information:
> https://git-scm.com/docs/git-cvsexportcommit.
* Merge a specific patch into CVS:
`git cvsexportcommit -v -c -w {{path/to/project_cvs_checkout}}
{{commit_sha1}}`"
What is sdiff command,,"# sdiff
> Compare the differences between and optionally merge 2 files. More
> information: https://manned.org/sdiff.
* Compare 2 files:
`sdiff {{path/to/file1}} {{path/to/file2}}`
* Compare 2 files, ignoring all tabs and whitespace:
`sdiff -W {{path/to/file1}} {{path/to/file2}}`
* Compare 2 files, ignoring whitespace at the end of lines:
`sdiff -Z {{path/to/file1}} {{path/to/file2}}`
* Compare 2 files in a case-insensitive manner:
`sdiff -i {{path/to/file1}} {{path/to/file2}}`
* Compare and then merge, writing the output to a new file:
`sdiff -o {{path/to/merged_file}} {{path/to/file1}} {{path/to/file2}}`"
What is dir command,,"# dir
> List directory contents using one line per file, special characters are
> represented by backslash escape sequences. Works as `ls -C --escape`. More
> information: https://manned.org/dir.
* List all files, including hidden files:
`dir -all`
* List files including their author (`-l` is required):
`dir -l --author`
* List files excluding those that match a specified blob pattern:
`dir --hide={{pattern}}`
* List subdirectories recursively:
`dir --recursive`
* Display help:
`dir --help`"
What is cd command,,"# cd
> Change the current working directory. More information:
> https://manned.org/cd.
* Go to the specified directory:
`cd {{path/to/directory}}`
* Go up to the parent of the current directory:
`cd ..`
* Go to the home directory of the current user:
`cd`
* Go to the home directory of the specified user:
`cd ~{{username}}`
* Go to the previously chosen directory:
`cd -`
* Go to the root directory:
`cd /`"
What is git-revert command,,"# git revert
> Create new commits which reverse the effect of earlier ones. More
> information: https://git-scm.com/docs/git-revert.
* Revert the most recent commit:
`git revert {{HEAD}}`
* Revert the 5th last commit:
`git revert HEAD~{{4}}`
* Revert a specific commit:
`git revert {{0c01a9}}`
* Revert multiple commits:
`git revert {{branch_name~5..branch_name~2}}`
* Don't create new commits, just change the working tree:
`git revert -n {{0c01a9..9a1743}}`"
What is pathchk command,,"# pathchk
> Check the validity and portability of one or more pathnames. More
> information: https://www.gnu.org/software/coreutils/pathchk.
* Check pathnames for validity in the current system:
`pathchk {{path1 path2 …}}`
* Check pathnames for validity on a wider range of POSIX compliant systems:
`pathchk -p {{path1 path2 …}}`
* Check pathnames for validity on all POSIX compliant systems:
`pathchk --portability {{path1 path2 …}}`
* Only check for empty pathnames or leading dashes (-):
`pathchk -P {{path1 path2 …}}`"
What is man command,,"# man
> Format and display manual pages. More information:
> https://www.man7.org/linux/man-pages/man1/man.1.html.
* Display the man page for a command:
`man {{command}}`
* Display the man page for a command from section 7:
`man {{7}} {{command}}`
* List all available sections for a command:
`man -f {{command}}`
* Display the path searched for manpages:
`man --path`
* Display the location of a manpage rather than the manpage itself:
`man -w {{command}}`
* Display the man page using a specific locale:
`man {{command}} --locale={{locale}}`
* Search for manpages containing a search string:
`man -k ""{{search_string}}""`"
What is ps command,,"# ps
> Information about running processes. More information:
> https://www.unix.com/man-page/osx/1/ps/.
* List all running processes:
`ps aux`
* List all running processes including the full command string:
`ps auxww`
* Search for a process that matches a string:
`ps aux | grep {{string}}`
* Get the parent PID of a process:
`ps -o ppid= -p {{pid}}`
* Sort processes by memory usage:
`ps -m`
* Sort processes by CPU usage:
`ps -r`"
What is git-ls-tree command,,"# git ls-tree
> List the contents of a tree object. More information: https://git-
> scm.com/docs/git-ls-tree.
* List the contents of the tree on a branch:
`git ls-tree {{branch_name}}`
* List the contents of the tree on a commit, recursing into subtrees:
`git ls-tree -r {{commit_hash}}`
* List only the filenames of the tree on a commit:
`git ls-tree --name-only {{commit_hash}}`"
What is ssh command,,"# ssh
> Secure Shell is a protocol used to securely log onto remote systems. It can
> be used for logging or executing commands on a remote server. More
> information: https://man.openbsd.org/ssh.
* Connect to a remote server:
`ssh {{username}}@{{remote_host}}`
* Connect to a remote server with a specific identity (private key):
`ssh -i {{path/to/key_file}} {{username}}@{{remote_host}}`
* Connect to a remote server using a specific port:
`ssh {{username}}@{{remote_host}} -p {{2222}}`
* Run a command on a remote server with a [t]ty allocation allowing interaction with the remote command:
`ssh {{username}}@{{remote_host}} -t {{command}} {{command_arguments}}`
* SSH tunneling: Dynamic port forwarding (SOCKS proxy on `localhost:1080`):
`ssh -D {{1080}} {{username}}@{{remote_host}}`
* SSH tunneling: Forward a specific port (`localhost:9999` to `example.org:80`) along with disabling pseudo-[T]ty allocation and executio[N] of remote commands:
`ssh -L {{9999}}:{{example.org}}:{{80}} -N -T {{username}}@{{remote_host}}`
* SSH jumping: Connect through a jumphost to a remote server (Multiple jump hops may be specified separated by comma characters):
`ssh -J {{username}}@{{jump_host}} {{username}}@{{remote_host}}`
* Agent forwarding: Forward the authentication information to the remote machine (see `man ssh_config` for available options):
`ssh -A {{username}}@{{remote_host}}`"
What is set command,,"# set
> Display, set or unset values of shell attributes and positional parameters.
> More information: https://manned.org/set.
* Display the names and values of shell variables:
`set`
* Mark variables that are modified or created for export:
`set -a`
* Notify of job termination immediately:
`set -b`
* Set various options, e.g. enable `vi` style line editing:
`set -o {{vi}}`
* Set the shell to exit as soon as the first error is encountered (mostly used in scripts):
`set -e`"
What is cut command,,"# cut
> Cut out fields from `stdin` or files. More information:
> https://manned.org/man/freebsd-13.0/cut.1.
* Print a specific character/field range of each line:
`{{command}} | cut -{{c|f}} {{1|1,10|1-10|1-|-10}}`
* Print a range of each line with a specific delimiter:
`{{command}} | cut -d ""{{,}}"" -{{c}} {{1}}`
* Print a range of each line of a specific file:
`cut -{{c}} {{1}} {{path/to/file}}`"
What is chfn command,,"# chfn
> Update `finger` info for a user. More information: https://manned.org/chfn.
* Update a user's ""Name"" field in the output of `finger`:
`chfn -f {{new_display_name}} {{username}}`
* Update a user's ""Office Room Number"" field for the output of `finger`:
`chfn -o {{new_office_room_number}} {{username}}`
* Update a user's ""Office Phone Number"" field for the output of `finger`:
`chfn -p {{new_office_telephone_number}} {{username}}`
* Update a user's ""Home Phone Number"" field for the output of `finger`:
`chfn -h {{new_home_telephone_number}} {{username}}`"
What is taskset command,,"# taskset
> Get or set a process' CPU affinity or start a new process with a defined CPU
> affinity. More information: https://manned.org/taskset.
* Get a running process' CPU affinity by PID:
`taskset --pid --cpu-list {{pid}}`
* Set a running process' CPU affinity by PID:
`taskset --pid --cpu-list {{cpu_id}} {{pid}}`
* Start a new process with affinity for a single CPU:
`taskset --cpu-list {{cpu_id}} {{command}}`
* Start a new process with affinity for multiple non-sequential CPUs:
`taskset --cpu-list {{cpu_id_1}},{{cpu_id_2}},{{cpu_id_3}}`
* Start a new process with affinity for CPUs 1 through 4:
`taskset --cpu-list {{cpu_id_1}}-{{cpu_id_4}}`"
What is script command,,"# script
> Make a typescript file of a terminal session. More information:
> https://manned.org/script.
* Start recording in file named ""typescript"":
`script`
* Stop recording:
`exit`
* Start recording in a given file:
`script {{logfile.log}}`
* Append to an existing file:
`script -a {{logfile.log}}`
* Execute quietly without start and done messages:
`script -q {{logfile.log}}`"
What is chown command,,"# chown
> Change user and group ownership of files and directories. More information:
> https://www.gnu.org/software/coreutils/chown.
* Change the owner user of a file/directory:
`chown {{user}} {{path/to/file_or_directory}}`
* Change the owner user and group of a file/directory:
`chown {{user}}:{{group}} {{path/to/file_or_directory}}`
* Recursively change the owner of a directory and its contents:
`chown -R {{user}} {{path/to/directory}}`
* Change the owner of a symbolic link:
`chown -h {{user}} {{path/to/symlink}}`
* Change the owner of a file/directory to match a reference file:
`chown --reference={{path/to/reference_file}} {{path/to/file_or_directory}}`"
What is g++ command,,"# g++
> Compiles C++ source files. Part of GCC (GNU Compiler Collection). More
> information: https://gcc.gnu.org.
* Compile a source code file into an executable binary:
`g++ {{path/to/source.cpp}} -o {{path/to/output_executable}}`
* Display common warnings:
`g++ {{path/to/source.cpp}} -Wall -o {{path/to/output_executable}}`
* Choose a language standard to compile for (C++98/C++11/C++14/C++17):
`g++ {{path/to/source.cpp}} -std={{c++98|c++11|c++14|c++17}} -o
{{path/to/output_executable}}`
* Include libraries located at a different path than the source file:
`g++ {{path/to/source.cpp}} -o {{path/to/output_executable}}
-I{{path/to/header}} -L{{path/to/library}} -l{{library_name}}`
* Compile and link multiple source code files into an executable binary:
`g++ -c {{path/to/source_1.cpp path/to/source_2.cpp ...}} && g++ -o
{{path/to/output_executable}} {{path/to/source_1.o path/to/source_2.o ...}}`
* Display version:
`g++ --version`"
What is cp command,,"# cp
> Copy files and directories. More information:
> https://www.gnu.org/software/coreutils/cp.
* Copy a file to another location:
`cp {{path/to/source_file.ext}} {{path/to/target_file.ext}}`
* Copy a file into another directory, keeping the filename:
`cp {{path/to/source_file.ext}} {{path/to/target_parent_directory}}`
* Recursively copy a directory's contents to another location (if the destination exists, the directory is copied inside it):
`cp -R {{path/to/source_directory}} {{path/to/target_directory}}`
* Copy a directory recursively, in verbose mode (shows files as they are copied):
`cp -vR {{path/to/source_directory}} {{path/to/target_directory}}`
* Copy multiple files at once to a directory:
`cp -t {{path/to/destination_directory}} {{path/to/file1 path/to/file2 ...}}`
* Copy text files to another location, in interactive mode (prompts user before overwriting):
`cp -i {{*.txt}} {{path/to/target_directory}}`
* Follow symbolic links before copying:
`cp -L {{link}} {{path/to/target_directory}}`
* Use the first argument as the destination directory (useful for `xargs ... | cp -t <DEST_DIR>`):
`cp -t {{path/to/target_directory}} {{path/to/file_or_directory1
path/to/file_or_directory2 ...}}`"
What is sar command,,"# sar
> Monitor performance of various Linux subsystems. More information:
> https://manned.org/sar.
* Report I/O and transfer rate issued to physical devices, one per second (press CTRL+C to quit):
`sar -b {{1}}`
* Report a total of 10 network device statistics, one per 2 seconds:
`sar -n DEV {{2}} {{10}}`
* Report CPU utilization, one per 2 seconds:
`sar -u ALL {{2}}`
* Report a total of 20 memory utilization statistics, one per second:
`sar -r ALL {{1}} {{20}}`
* Report the run queue length and load averages, one per second:
`sar -q {{1}}`
* Report paging statistics, one per 5 seconds:
`sar -B {{5}}`"
What is rename command,,"# rename
> Rename a file or group of files with a regular expression. More information:
> https://www.manpagez.com/man/2/rename/.
* Replace `from` with `to` in the filenames of the specified files:
`rename 's/{{from}}/{{to}}/' {{*.txt}}`"
What is strip command,,"# strip
> Discard symbols from executables or object files. More information:
> https://manned.org/strip.
* Replace the input file with its stripped version:
`strip {{path/to/file}}`
* Strip symbols from a file, saving the output to a specific file:
`strip {{path/to/input_file}} -o {{path/to/output_file}}`
* Strip debug symbols only:
`strip --strip-debug {{path/to/file.o}}`"
What is head command,,"# head
> Output the first part of files. More information:
> https://keith.github.io/xcode-man-pages/head.1.html.
* Output the first few lines of a file:
`head --lines {{8}} {{path/to/file}}`
* Output the first few bytes of a file:
`head --bytes {{8}} {{path/to/file}}`
* Output everything but the last few lines of a file:
`head --lines -{{8}} {{path/to/file}}`
* Output everything but the last few bytes of a file:
`head --bytes -{{8}} {{path/to/file}}`"
What is wall command,,"# wall
> Write a message on the terminals of users currently logged in. More
> information: https://manned.org/wall.
* Send a message:
`wall {{message}}`
* Send a message to users that belong to a specific group:
`wall --group {{group_name}} {{message}}`
* Send a message from a file:
`wall {{file}}`
* Send a message with timeout (default 300):
`wall --timeout {{seconds}} {{file}}`"
What is stat command,,"# stat
> Display file status. More information: https://ss64.com/osx/stat.html.
* Show file properties such as size, permissions, creation and access dates among others:
`stat {{path/to/file}}`
* Same as above but verbose (more similar to Linux's `stat`):
`stat -x {{path/to/file}}`
* Show only octal file permissions:
`stat -f %Mp%Lp {{path/to/file}}`
* Show owner and group of the file:
`stat -f ""%Su %Sg"" {{path/to/file}}`
* Show the size of the file in bytes:
`stat -f ""%z %N"" {{path/to/file}}`"
What is ar command,,"# ar
> Create, modify, and extract from Unix archives. Typically used for static
> libraries (`.a`) and Debian packages (`.deb`). See also: `tar`. More
> information: https://manned.org/ar.
* E[x]tract all members from an archive:
`ar x {{path/to/file.a}}`
* Lis[t] contents in a specific archive:
`ar t {{path/to/file.ar}}`
* [r]eplace or add specific files to an archive:
`ar r {{path/to/file.deb}} {{path/to/debian-binary path/to/control.tar.gz
path/to/data.tar.xz ...}}`
* In[s]ert an object file index (equivalent to using `ranlib`):
`ar s {{path/to/file.a}}`
* Create an archive with specific files and an accompanying object file index:
`ar rs {{path/to/file.a}} {{path/to/file1.o path/to/file2.o ...}}`"
What is git command,,"# git
> Distributed version control system. Some subcommands such as `commit`,
> `add`, `branch`, `checkout`, `push`, etc. have their own usage
> documentation, accessible via `tldr git subcommand`. More information:
> https://git-scm.com/.
* Check the Git version:
`git --version`
* Show general help:
`git --help`
* Show help on a Git subcommand (like `clone`, `add`, `push`, `log`, etc.):
`git help {{subcommand}}`
* Execute a Git subcommand:
`git {{subcommand}}`
* Execute a Git subcommand on a custom repository root path:
`git -C {{path/to/repo}} {{subcommand}}`
* Execute a Git subcommand with a given configuration set:
`git -c '{{config.key}}={{value}}' {{subcommand}}`"
What is printenv command,,"# printenv
> Print values of all or specific environment variables. More information:
> https://www.gnu.org/software/coreutils/printenv.
* Display key-value pairs of all environment variables:
`printenv`
* Display the value of a specific variable:
`printenv {{HOME}}`
* Display the value of a variable and end with NUL instead of newline:
`printenv --null {{HOME}}`"
What is chsh command,,"# chsh
> Change user's login shell. More information: https://manned.org/chsh.
* Set a specific login shell for the current user interactively:
`chsh`
* Set a specific login [s]hell for the current user:
`chsh -s {{path/to/shell}}`
* Set a login [s]hell for a specific user:
`chsh -s {{path/to/shell}} {{username}}`
* [l]ist available shells:
`chsh -l`"
What is pax command,,"# pax
> Archiving and copying utility. More information: https://manned.org/pax.1p.
* List the contents of an archive:
`pax -f {{archive.tar}}`
* List the contents of a gzipped archive:
`pax -zf {{archive.tar.gz}}`
* Create an archive from files:
`pax -wf {{target.tar}} {{path/to/file1}} {{path/to/file2}} {{path/to/file3}}`
* Create an archive from files, using output redirection:
`pax -w {{path/to/file1}} {{path/to/file2}} {{path/to/file3}} >
{{target.tar}}`
* Extract an archive into the current directory:
`pax -rf {{source.tar}}`
* Copy to a directory, while keeping the original metadata; `target/` must exist:
`pax -rw {{path/to/file1}} {{path/to/directory1}} {{path/to/directory2}}
{{target/}}`"
What is git-replace command,,"# git replace
> Create, list, and delete refs to replace objects. More information:
> https://git-scm.com/docs/git-replace.
* Replace any commit with a different one, leaving other commits unchanged:
`git replace {{object}} {{replacement}}`
* Delete existing replace refs for the given objects:
`git replace --delete {{object}}`
* Edit an object’s content interactively:
`git replace --edit {{object}}`"
What is yes command,,"# yes
> Output something repeatedly. This command is commonly used to answer yes to
> every prompt by install commands (such as apt-get). More information:
> https://www.gnu.org/software/coreutils/yes.
* Repeatedly output ""message"":
`yes {{message}}`
* Repeatedly output ""y"":
`yes`
* Accept everything prompted by the `apt-get` command:
`yes | sudo apt-get install {{program}}`"
What is mkdir command,,"# mkdir
> Create directories and set their permissions. More information:
> https://www.gnu.org/software/coreutils/mkdir.
* Create specific directories:
`mkdir {{path/to/directory1 path/to/directory2 ...}}`
* Create specific directories and their [p]arents if needed:
`mkdir -p {{path/to/directory1 path/to/directory2 ...}}`
* Create directories with specific permissions:
`mkdir -m {{rwxrw-r--}} {{path/to/directory1 path/to/directory2 ...}}`"
What is ipcrm command,,"# ipcrm
> Delete IPC (Inter-process Communication) resources. More information:
> https://manned.org/ipcrm.
* Delete a shared memory segment by ID:
`ipcrm --shmem-id {{shmem_id}}`
* Delete a shared memory segment by key:
`ipcrm --shmem-key {{shmem_key}}`
* Delete an IPC queue by ID:
`ipcrm --queue-id {{ipc_queue_id}}`
* Delete an IPC queue by key:
`ipcrm --queue-key {{ipc_queue_key}}`
* Delete a semaphore by ID:
`ipcrm --semaphore-id {{semaphore_id}}`
* Delete a semaphore by key:
`ipcrm --semaphore-key {{semaphore_key}}`
* Delete all IPC resources:
`ipcrm --all`"
What is chmod command,,"# chmod
> Change the access permissions of a file or directory. More information:
> https://www.gnu.org/software/coreutils/chmod.
* Give the [u]ser who owns a file the right to e[x]ecute it:
`chmod u+x {{path/to/file}}`
* Give the [u]ser rights to [r]ead and [w]rite to a file/directory:
`chmod u+rw {{path/to/file_or_directory}}`
* Remove e[x]ecutable rights from the [g]roup:
`chmod g-x {{path/to/file}}`
* Give [a]ll users rights to [r]ead and e[x]ecute:
`chmod a+rx {{path/to/file}}`
* Give [o]thers (not in the file owner's group) the same rights as the [g]roup:
`chmod o=g {{path/to/file}}`
* Remove all rights from [o]thers:
`chmod o= {{path/to/file}}`
* Change permissions recursively giving [g]roup and [o]thers the ability to [w]rite:
`chmod -R g+w,o+w {{path/to/directory}}`
* Recursively give [a]ll users [r]ead permissions to files and e[X]ecute permissions to sub-directories within a directory:
`chmod -R a+rX {{path/to/directory}}`"
What is git-help command,,"# git help
> Display help information about Git. More information: https://git-
> scm.com/docs/git-help.
* Display help about a specific Git subcommand:
`git help {{subcommand}}`
* Display help about a specific Git subcommand in a web browser:
`git help --web {{subcommand}}`
* Display a list of all available Git subcommands:
`git help --all`
* List the available guides:
`git help --guide`
* List all possible configuration variables:
`git help --config`"
What is sort command,,"# sort
> Sort lines of text files. More information:
> https://www.gnu.org/software/coreutils/sort.
* Sort a file in ascending order:
`sort {{path/to/file}}`
* Sort a file in descending order:
`sort --reverse {{path/to/file}}`
* Sort a file in case-insensitive way:
`sort --ignore-case {{path/to/file}}`
* Sort a file using numeric rather than alphabetic order:
`sort --numeric-sort {{path/to/file}}`
* Sort `/etc/passwd` by the 3rd field of each line numerically, using "":"" as a field separator:
`sort --field-separator={{:}} --key={{3n}} {{/etc/passwd}}`
* Sort a file preserving only unique lines:
`sort --unique {{path/to/file}}`
* Sort a file, printing the output to the specified output file (can be used to sort a file in-place):
`sort --output={{path/to/file}} {{path/to/file}}`
* Sort numbers with exponents:
`sort --general-numeric-sort {{path/to/file}}`"
What is md5sum command,,"# md5sum
> Calculate MD5 cryptographic checksums. More information:
> https://www.gnu.org/software/coreutils/md5sum.
* Calculate the MD5 checksum for one or more files:
`md5sum {{path/to/file1 path/to/file2 ...}}`
* Calculate and save the list of MD5 checksums to a file:
`md5sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.md5}}`
* Calculate an MD5 checksum from `stdin`:
`{{command}} | md5sum`
* Read a file of MD5 sums and filenames and verify all files have matching checksums:
`md5sum --check {{path/to/file.md5}}`
* Only show a message for missing files or when verification fails:
`md5sum --check --quiet {{path/to/file.md5}}`
* Only show a message when verification fails, ignoring missing files:
`md5sum --ignore-missing --check --quiet {{path/to/file.md5}}`"
What is kill command,,"# kill
> Sends a signal to a process, usually related to stopping the process. All
> signals except for SIGKILL and SIGSTOP can be intercepted by the process to
> perform a clean exit. More information: https://manned.org/kill.
* Terminate a program using the default SIGTERM (terminate) signal:
`kill {{process_id}}`
* List available signal names (to be used without the `SIG` prefix):
`kill -l`
* Terminate a background job:
`kill %{{job_id}}`
* Terminate a program using the SIGHUP (hang up) signal. Many daemons will reload instead of terminating:
`kill -{{1|HUP}} {{process_id}}`
* Terminate a program using the SIGINT (interrupt) signal. This is typically initiated by the user pressing `Ctrl + C`:
`kill -{{2|INT}} {{process_id}}`
* Signal the operating system to immediately terminate a program (which gets no chance to capture the signal):
`kill -{{9|KILL}} {{process_id}}`
* Signal the operating system to pause a program until a SIGCONT (""continue"") signal is received:
`kill -{{17|STOP}} {{process_id}}`
* Send a `SIGUSR1` signal to all processes with the given GID (group id):
`kill -{{SIGUSR1}} -{{group_id}}`"
What is groff command,,"# groff
> GNU replacement for the `troff` and `nroff` typesetting utilities. More
> information: https://www.gnu.org/software/groff.
* Format output for a PostScript printer, saving the output to a file:
`groff {{path/to/input.roff}} > {{path/to/output.ps}}`
* Render a man page using the ASCII output device, and display it using a pager:
`groff -man -T ascii {{path/to/manpage.1}} | less --RAW-CONTROL-CHARS`
* Render a man page into an HTML file:
`groff -man -T html {{path/to/manpage.1}} > {{path/to/manpage.html}}`
* Typeset a roff file containing [t]ables and [p]ictures, using the [me] macro set, to PDF, saving the output:
`groff {{-t}} {{-p}} -{{me}} -T {{pdf}} {{path/to/input.me}} >
{{path/to/output.pdf}}`
* Run a `groff` command with preprocessor and macro options guessed by the `grog` utility:
`eval ""$(grog -T utf8 {{path/to/input.me}})""`"
What is git-checkout-index command,,"# git checkout-index
> Copy files from the index to the working tree. More information:
> https://git-scm.com/docs/git-checkout-index.
* Restore any files deleted since the last commit:
`git checkout-index --all`
* Restore any files deleted or changed since the last commit:
`git checkout-index --all --force`
* Restore any files changed since the last commit, ignoring any files that were deleted:
`git checkout-index --all --force --no-create`
* Export a copy of the entire tree at the last commit to the specified directory (the trailing slash is important):
`git checkout-index --all --force --prefix={{path/to/export_directory/}}`"
What is trace-cmd command,,"# trace-cmd
> Utility to interact with the Ftrace Linux kernel internal tracer. This
> utility only runs as root. More information: https://manned.org/trace-cmd.
* Display the status of tracing system:
`trace-cmd stat`
* List available tracers:
`trace-cmd list -t`
* Start tracing with a specific plugin:
`trace-cmd start -p
{{timerlat|osnoise|hwlat|blk|mmiotrace|function_graph|wakeup_dl|wakeup_rt|wakeup|function|nop}}`
* View the trace output:
`trace-cmd show`
* Stop the tracing but retain the buffers:
`trace-cmd stop`
* Clear the trace buffers:
`trace-cmd clear`
* Clear the trace buffers and stop tracing:
`trace-cmd reset`"
What is umask command,,"# umask
> Manage the read/write/execute permissions that are masked out (i.e.
> restricted) for newly created files by the user. More information:
> https://manned.org/umask.
* Display the current mask in octal notation:
`umask`
* Display the current mask in symbolic (human-readable) mode:
`umask -S`
* Change the mask symbolically to allow read permission for all users (the rest of the mask bits are unchanged):
`umask {{a+r}}`
* Set the mask (using octal) to restrict no permissions for the file's owner, and restrict all permissions for everyone else:
`umask {{077}}`"
What is touch command,,"# touch
> Create files and set access/modification times. More information:
> https://manned.org/man/freebsd-13.1/touch.
* Create specific files:
`touch {{path/to/file1 path/to/file2 ...}}`
* Set the file [a]ccess or [m]odification times to the current one and don't [c]reate file if it doesn't exist:
`touch -c -{{a|m}} {{path/to/file1 path/to/file2 ...}}`
* Set the file [t]ime to a specific value and don't [c]reate file if it doesn't exist:
`touch -c -t {{YYYYMMDDHHMM.SS}} {{path/to/file1 path/to/file2 ...}}`
* Set the file time of a specific file to the time of anothe[r] file and don't [c]reate file if it doesn't exist:
`touch -c -r {{~/.emacs}} {{path/to/file1 path/to/file2 ...}}`"
What is echo command,,"# echo
> Print given arguments. More information:
> https://www.gnu.org/software/coreutils/echo.
* Print a text message. Note: quotes are optional:
`echo ""{{Hello World}}""`
* Print a message with environment variables:
`echo ""{{My path is $PATH}}""`
* Print a message without the trailing newline:
`echo -n ""{{Hello World}}""`
* Append a message to the file:
`echo ""{{Hello World}}"" >> {{file.txt}}`
* Enable interpretation of backslash escapes (special characters):
`echo -e ""{{Column 1\tColumn 2}}""`
* Print the exit status of the last executed command (Note: In Windows Command Prompt and PowerShell the equivalent commands are `echo %errorlevel%` and `$lastexitcode` respectively):
`echo $?`"
What is systemctl command,,"# systemctl
> Control the systemd system and service manager. More information:
> https://www.freedesktop.org/software/systemd/man/systemctl.html.
* Show all running services:
`systemctl status`
* List failed units:
`systemctl --failed`
* Start/Stop/Restart/Reload a service:
`systemctl {{start|stop|restart|reload}} {{unit}}`
* Show the status of a unit:
`systemctl status {{unit}}`
* Enable/Disable a unit to be started on bootup:
`systemctl {{enable|disable}} {{unit}}`
* Mask/Unmask a unit to prevent enablement and manual activation:
`systemctl {{mask|unmask}} {{unit}}`
* Reload systemd, scanning for new or changed units:
`systemctl daemon-reload`
* Check if a unit is enabled:
`systemctl is-enabled {{unit}}`"
What is patch command,,"# patch
> Patch a file (or files) with a diff file. Note that diff files should be
> generated by the `diff` command. More information: https://manned.org/patch.
* Apply a patch using a diff file (filenames must be included in the diff file):
`patch < {{patch.diff}}`
* Apply a patch to a specific file:
`patch {{path/to/file}} < {{patch.diff}}`
* Patch a file writing the result to a different file:
`patch {{path/to/input_file}} -o {{path/to/output_file}} < {{patch.diff}}`
* Apply a patch to the current directory:
`patch -p1 < {{patch.diff}}`
* Apply the reverse of a patch:
`patch -R < {{patch.diff}}`"
What is find command,,"# find
> Find files or directories under the given directory tree, recursively. More
> information: https://manned.org/find.
* Find files by extension:
`find {{root_path}} -name '{{*.ext}}'`
* Find files matching multiple path/name patterns:
`find {{root_path}} -path '{{**/path/**/*.ext}}' -or -name '{{*pattern*}}'`
* Find directories matching a given name, in case-insensitive mode:
`find {{root_path}} -type d -iname '{{*lib*}}'`
* Find files matching a given pattern, excluding specific paths:
`find {{root_path}} -name '{{*.py}}' -not -path '{{*/site-packages/*}}'`
* Find files matching a given size range, limiting the recursive depth to ""1"":
`find {{root_path}} -maxdepth 1 -size {{+500k}} -size {{-10M}}`
* Run a command for each file (use `{}` within the command to access the filename):
`find {{root_path}} -name '{{*.ext}}' -exec {{wc -l {} }}\;`
* Find files modified in the last 7 days:
`find {{root_path}} -daystart -mtime -{{7}}`
* Find empty (0 byte) files and delete them:
`find {{root_path}} -type {{f}} -empty -delete`"
What is expect command,,"# expect
> Script executor that interacts with other programs that require user input.
> More information: https://manned.org/expect.
* Execute an expect script from a file:
`expect {{path/to/file}}`
* Execute a specified expect script:
`expect -c ""{{commands}}""`
* Enter an interactive REPL (use `exit` or Ctrl + D to exit):
`expect -i`"
What is du command,,"# du
> Disk usage: estimate and summarize file and directory space usage. More
> information: https://ss64.com/osx/du.html.
* List the sizes of a directory and any subdirectories, in the given unit (KiB/MiB/GiB):
`du -{{k|m|g}} {{path/to/directory}}`
* List the sizes of a directory and any subdirectories, in human-readable form (i.e. auto-selecting the appropriate unit for each size):
`du -h {{path/to/directory}}`
* Show the size of a single directory, in human-readable units:
`du -sh {{path/to/directory}}`
* List the human-readable sizes of a directory and of all the files and directories within it:
`du -ah {{path/to/directory}}`
* List the human-readable sizes of a directory and any subdirectories, up to N levels deep:
`du -h -d {{2}} {{path/to/directory}}`
* List the human-readable size of all `.jpg` files in subdirectories of the current directory, and show a cumulative total at the end:
`du -ch {{*/*.jpg}}`"
What is fold command,,"# fold
> Wrap each line in an input file to fit a specified width and print it to
> `stdout`. More information: https://manned.org/fold.1p.
* Wrap each line to default width (80 characters):
`fold {{path/to/file}}`
* Wrap each line to width ""30"":
`fold -w30 {{path/to/file}}`
* Wrap each line to width ""5"" and break the line at spaces (puts each space separated word in a new line, words with length > 5 are wrapped):
`fold -w5 -s {{path/to/file}}`"
What is nohup command,,"# nohup
> Allows for a process to live when the terminal gets killed. More
> information: https://www.gnu.org/software/coreutils/nohup.
* Run a process that can live beyond the terminal:
`nohup {{command}} {{argument1 argument2 ...}}`
* Launch `nohup` in background mode:
`nohup {{command}} {{argument1 argument2 ...}} &`
* Run a shell script that can live beyond the terminal:
`nohup {{path/to/script.sh}} &`
* Run a process and write the output to a specific file:
`nohup {{command}} {{argument1 argument2 ...}} > {{path/to/output_file}} &`"
What is git-rm command,,"# git rm
> Remove files from repository index and local filesystem. More information:
> https://git-scm.com/docs/git-rm.
* Remove file from repository index and filesystem:
`git rm {{path/to/file}}`
* Remove directory:
`git rm -r {{path/to/directory}}`
* Remove file from repository index but keep it untouched locally:
`git rm --cached {{path/to/file}}`"
What is getconf command,,"# getconf
> Get configuration values from your Linux system. More information:
> https://manned.org/getconf.1.
* List [a]ll configuration values available:
`getconf -a`
* List the configuration values for a specific directory:
`getconf -a {{path/to/directory}}`
* Check if your linux system is a 32-bit or 64-bit:
`getconf LONG_BIT`
* Check how many processes the current user can run at once:
`getconf CHILD_MAX`
* List every configuration value and then find patterns with the grep command (i.e every value with MAX in it):
`getconf -a | grep MAX`"
What is wget command,,"# wget
> Download files from the Web. Supports HTTP, HTTPS, and FTP. More
> information: https://www.gnu.org/software/wget.
* Download the contents of a URL to a file (named ""foo"" in this case):
`wget {{https://example.com/foo}}`
* Download the contents of a URL to a file (named ""bar"" in this case):
`wget --output-document {{bar}} {{https://example.com/foo}}`
* Download a single web page and all its resources with 3-second intervals between requests (scripts, stylesheets, images, etc.):
`wget --page-requisites --convert-links --wait=3
{{https://example.com/somepage.html}}`
* Download all listed files within a directory and its sub-directories (does not download embedded page elements):
`wget --mirror --no-parent {{https://example.com/somepath/}}`
* Limit the download speed and the number of connection retries:
`wget --limit-rate={{300k}} --tries={{100}} {{https://example.com/somepath/}}`
* Download a file from an HTTP server using Basic Auth (also works for FTP):
`wget --user={{username}} --password={{password}} {{https://example.com}}`
* Continue an incomplete download:
`wget --continue {{https://example.com}}`
* Download all URLs stored in a text file to a specific directory:
`wget --directory-prefix {{path/to/directory}} --input-file {{URLs.txt}}`"
What is systemd-mount command,,"# systemd-mount
> Establish and destroy transient mount or auto-mount points. More
> information: https://www.freedesktop.org/software/systemd/man/systemd-
> mount.html.
* Mount a file system (image or block device) at `/run/media/system/LABEL` where LABEL is the filesystem label or the device name if there is no label:
`systemd-mount {{path/to/file_or_device}}`
* Mount a file system (image or block device) at a specific location:
`systemd-mount {{path/to/file_or_device}} {{path/to/mount_point}}`
* Show a list of all local, known block devices with file systems that may be mounted:
`systemd-mount --list`
* Create an automount point that mounts the actual file system at the time of first access:
`systemd-mount --automount=yes {{path/to/file_or_device}}`
* Unmount one or more devices:
`systemd-mount --umount {{path/to/mount_point_or_device1}}
{{path/to/mount_point_or_device2}}`
* Mount a file system (image or block device) with a specific file system type:
`systemd-mount --type={{file_system_type}} {{path/to/file_or_device}}
{{path/to/mount_point}}`
* Mount a file system (image or block device) with additional mount options:
`systemd-mount --options={{mount_options}} {{path/to/file_or_device}}
{{path/to/mount_point}}`"
What is date command,,"# date
> Set or display the system date. More information:
> https://ss64.com/osx/date.html.
* Display the current date using the default locale's format:
`date +%c`
* Display the current date in UTC and ISO 8601 format:
`date -u +%Y-%m-%dT%H:%M:%SZ`
* Display the current date as a Unix timestamp (seconds since the Unix epoch):
`date +%s`
* Display a specific date (represented as a Unix timestamp) using the default format:
`date -r 1473305798`"
What is mcookie command,,"# mcookie
> Generates random 128-bit hexadecimal numbers. More information:
> https://manned.org/mcookie.
* Generate a random number:
`mcookie`
* Generate a random number, using the contents of a file as a seed for the randomness:
`mcookie --file {{path/to/file}}`
* Generate a random number, using a specific number of bytes from a file as a seed for the randomness:
`mcookie --file {{path/to/file}} --max-size {{number_of_bytes}}`
* Print the details of the randomness used, such as the origin and seed for each source:
`mcookie --verbose`"
What is scriptreplay command,,"# scriptreplay
> Replay a typescript created by the `script` command to `stdout`. More
> information: https://manned.org/scriptreplay.
* Replay a typescript at the speed it was recorded:
`scriptreplay {{path/to/timing_file}} {{path/to/typescript}}`
* Replay a typescript at double the original speed:
`scriptreplay {{path/to/timingfile}} {{path/to/typescript}} 2`
* Replay a typescript at half the original speed:
`scriptreplay {{path/to/timingfile}} {{path/to/typescript}} 0.5`"
What is git-repack command,,"# git repack
> Pack unpacked objects in a Git repository. More information: https://git-
> scm.com/docs/git-repack.
* Pack unpacked objects in the current directory:
`git repack`
* Also remove redundant objects after packing:
`git repack -d`"
What is rev command,,"# rev
> Reverse a line of text. More information: https://manned.org/rev.
* Reverse the text string ""hello"":
`echo ""hello"" | rev`
* Reverse an entire file and print to `stdout`:
`rev {{path/to/file}}`"
What is logname command,,"# logname
> Shows the user's login name. More information:
> https://www.gnu.org/software/coreutils/logname.
* Display the currently logged in user's name:
`logname`"
What is true command,,"# true
> Returns a successful exit status code of 0. Use this with the || operator to
> make a command always exit with 0. More information:
> https://www.gnu.org/software/coreutils/true.
* Return a successful exit code:
`true`"
What is sed command,,"# sed
> Edit text in a scriptable manner. See also: `awk`, `ed`. More information:
> https://keith.github.io/xcode-man-pages/sed.1.html.
* Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in all input lines and print the result to `stdout`:
`{{command}} | sed 's/apple/mango/g'`
* Execute a specific script [f]ile and print the result to `stdout`:
`{{command}} | sed -f {{path/to/script_file.sed}}`
* Replace all `apple` (extended regex) occurrences with `APPLE` (extended regex) in all input lines and print the result to `stdout`:
`{{command}} | sed -E 's/(apple)/\U\1/g'`
* Print just a first line to `stdout`:
`{{command}} | sed -n '1p'`
* Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in a `file` and save a backup of the original to `file.bak`:
`sed -i bak 's/apple/mango/g' {{path/to/file}}`"
What is lsattr command,,"# lsattr
> List file attributes on a Linux filesystem. More information:
> https://manned.org/lsattr.
* Display the attributes of the files in the current directory:
`lsattr`
* List the attributes of files in a particular path:
`lsattr {{path}}`
* List file attributes recursively in the current and subsequent directories:
`lsattr -R`
* Show attributes of all the files in the current directory, including hidden ones:
`lsattr -a`
* Display attributes of directories in the current directory:
`lsattr -d`"
What is delta command,,"# delta
> A viewer for Git and diff output. More information:
> https://github.com/dandavison/delta.
* Compare files or directories:
`delta {{path/to/old_file_or_directory}} {{path/to/new_file_or_directory}}`
* Compare files or directories, showing the line numbers:
`delta --line-numbers {{path/to/old_file_or_directory}}
{{path/to/new_file_or_directory}}`
* Compare files or directories, showing the differences side by side:
`delta --side-by-side {{path/to/old_file_or_directory}}
{{path/to/new_file_or_directory}}`
* Compare files or directories, ignoring any Git configuration settings:
`delta --no-gitconfig {{path/to/old_file_or_directory}}
{{path/to/new_file_or_directory}}`
* Compare, rendering commit hashes, file names, and line numbers as hyperlinks, according to the hyperlink spec for terminal emulators:
`delta --hyperlinks {{path/to/old_file_or_directory}}
{{path/to/new_file_or_directory}}`
* Display the current settings:
`delta --show-config`
* Display supported languages and associated file extensions:
`delta --list-languages`"
What is git-submodule command,,"# git submodule
> Inspects, updates and manages submodules. More information: https://git-
> scm.com/docs/git-submodule.
* Install a repository's specified submodules:
`git submodule update --init --recursive`
* Add a Git repository as a submodule:
`git submodule add {{repository_url}}`
* Add a Git repository as a submodule at the specified directory:
`git submodule add {{repository_url}} {{path/to/directory}}`
* Update every submodule to its latest commit:
`git submodule foreach git pull`"
What is git-send-email command,,"# git send-email
> Send a collection of patches as emails. Patches can be specified as files,
> directions, or a revision list. More information: https://git-
> scm.com/docs/git-send-email.
* Send the last commit in the current branch:
`git send-email -1`
* Send a given commit:
`git send-email -1 {{commit}}`
* Send multiple (e.g. 10) commits in the current branch:
`git send-email {{-10}}`
* Send an introductory email message for the patch series:
`git send-email -{{number_of_commits}} --compose`
* Review and edit the email message for each patch you're about to send:
`git send-email -{{number_of_commits}} --annotate`"
What is git-checkout command,,"# git checkout
> Checkout a branch or paths to the working tree. More information:
> https://git-scm.com/docs/git-checkout.
* Create and switch to a new branch:
`git checkout -b {{branch_name}}`
* Create and switch to a new branch based on a specific reference (branch, remote/branch, tag are examples of valid references):
`git checkout -b {{branch_name}} {{reference}}`
* Switch to an existing local branch:
`git checkout {{branch_name}}`
* Switch to the previously checked out branch:
`git checkout -`
* Switch to an existing remote branch:
`git checkout --track {{remote_name}}/{{branch_name}}`
* Discard all unstaged changes in the current directory (see `git reset` for more undo-like commands):
`git checkout .`
* Discard unstaged changes to a given file:
`git checkout {{path/to/file}}`
* Replace a file in the current directory with the version of it committed in a given branch:
`git checkout {{branch_name}} -- {{path/to/file}}`"
What is git-show-ref command,,"# git show-ref
> Git command for listing references. More information: https://git-
> scm.com/docs/git-show-ref.
* Show all refs in the repository:
`git show-ref`
* Show only heads references:
`git show-ref --heads`
* Show only tags references:
`git show-ref --tags`
* Verify that a given reference exists:
`git show-ref --verify {{path/to/ref}}`"
What is tbl command,,"# tbl
> Table preprocessor for the groff (GNU Troff) document formatting system. See
> also `groff` and `troff`. More information: https://manned.org/tbl.
* Process input with tables, saving the output for future typesetting with groff to PostScript:
`tbl {{path/to/input_file}} > {{path/to/output.roff}}`
* Typeset input with tables to PDF using the [me] macro package:
`tbl -T {{pdf}} {{path/to/input.tbl}} | groff -{{me}} -T {{pdf}} >
{{path/to/output.pdf}}`"
What is fg command,,"# fg
> Run jobs in foreground. More information: https://manned.org/fg.
* Bring most recently suspended or running background job to foreground:
`fg`
* Bring a specific job to foreground:
`fg %{{job_id}}`"
What is kill command,,"# kill
> Sends a signal to a process, usually related to stopping the process. All
> signals except for SIGKILL and SIGSTOP can be intercepted by the process to
> perform a clean exit. More information: https://manned.org/kill.
* Terminate a program using the default SIGTERM (terminate) signal:
`kill {{process_id}}`
* List available signal names (to be used without the `SIG` prefix):
`kill -l`
* Terminate a background job:
`kill %{{job_id}}`
* Terminate a program using the SIGHUP (hang up) signal. Many daemons will reload instead of terminating:
`kill -{{1|HUP}} {{process_id}}`
* Terminate a program using the SIGINT (interrupt) signal. This is typically initiated by the user pressing `Ctrl + C`:
`kill -{{2|INT}} {{process_id}}`
* Signal the operating system to immediately terminate a program (which gets no chance to capture the signal):
`kill -{{9|KILL}} {{process_id}}`
* Signal the operating system to pause a program until a SIGCONT (""continue"") signal is received:
`kill -{{17|STOP}} {{process_id}}`
* Send a `SIGUSR1` signal to all processes with the given GID (group id):
`kill -{{SIGUSR1}} -{{group_id}}`"
What is git-credential command,,"# git credential
> Retrieve and store user credentials. More information: https://git-
> scm.com/docs/git-credential.
* Display credential information, retrieving the username and password from configuration files:
`echo ""{{url=http://example.com}}"" | git credential fill`
* Send credential information to all configured credential helpers to store for later use:
`echo ""{{url=http://example.com}}"" | git credential approve`
* Erase the specified credential information from all the configured credential helpers:
`echo ""{{url=http://example.com}}"" | git credential reject`"
What is git-stripspace command,,"# git stripspace
> Read text (e.g. commit messages, notes, tags, and branch descriptions) from
> `stdin` and clean it into the manner used by Git. More information:
> https://git-scm.com/docs/git-stripspace.
* Trim whitespace from a file:
`cat {{path/to/file}} | git stripspace`
* Trim whitespace and Git comments from a file:
`cat {{path/to/file}} | git stripspace --strip-comments`
* Convert all lines in a file into Git comments:
`git stripspace --comment-lines < {{path/to/file}}`"
What is hostname command,,"# hostname
> Show or set the system's host name. More information:
> https://manned.org/hostname.
* Show current host name:
`hostname`
* Show the network address of the host name:
`hostname -i`
* Show all network addresses of the host:
`hostname -I`
* Show the FQDN (Fully Qualified Domain Name):
`hostname --fqdn`
* Set current host name:
`hostname {{new_hostname}}`"
What is fuser command,,"# fuser
> Display process IDs currently using files or sockets. More information:
> https://manned.org/fuser.
* Find which processes are accessing a file or directory:
`fuser {{path/to/file_or_directory}}`
* Show more fields (`USER`, `PID`, `ACCESS` and `COMMAND`):
`fuser --verbose {{path/to/file_or_directory}}`
* Identify processes using a TCP socket:
`fuser --namespace tcp {{port}}`
* Kill all processes accessing a file or directory (sends the `SIGKILL` signal):
`fuser --kill {{path/to/file_or_directory}}`
* Find which processes are accessing the filesystem containing a specific file or directory:
`fuser --mount {{path/to/file_or_directory}}`
* Kill all processes with a TCP connection on a specific port:
`fuser --kill {{port}}/tcp`"
What is git-mergetool command,,"# git mergetool
> Run merge conflict resolution tools to resolve merge conflicts. More
> information: https://git-scm.com/docs/git-mergetool.
* Launch the default merge tool to resolve conflicts:
`git mergetool`
* List valid merge tools:
`git mergetool --tool-help`
* Launch the merge tool identified by a name:
`git mergetool --tool {{tool_name}}`
* Don't prompt before each invocation of the merge tool:
`git mergetool --no-prompt`
* Explicitly use the GUI merge tool (see the `merge.guitool` config variable):
`git mergetool --gui`
* Explicitly use the regular merge tool (see the `merge.tool` config variable):
`git mergetool --no-gui`"
What is su command,,"# su
> Switch shell to another user. More information: https://manned.org/su.
* Switch to superuser (requires the root password):
`su`
* Switch to a given user (requires the user's password):
`su {{username}}`
* Switch to a given user and simulate a full login shell:
`su - {{username}}`
* Execute a command as another user:
`su - {{username}} -c ""{{command}}""`"
What is git-request-pull command,,"# git request-pull
> Generate a request asking the upstream project to pull changes into its
> tree. More information: https://git-scm.com/docs/git-request-pull.
* Produce a request summarizing the changes between the v1.1 release and a specified branch:
`git request-pull {{v1.1}} {{https://example.com/project}} {{branch_name}}`
* Produce a request summarizing the changes between the v0.1 release on the `foo` branch and the local `bar` branch:
`git request-pull {{v0.1}} {{https://example.com/project}} {{foo:bar}}`"
What is perf command,,"# perf
> Framework for Linux performance counter measurements. More information:
> https://perf.wiki.kernel.org.
* Display basic performance counter stats for a command:
`perf stat {{gcc hello.c}}`
* Display system-wide real-time performance counter profile:
`sudo perf top`
* Run a command and record its profile into `perf.data`:
`sudo perf record {{command}}`
* Record the profile of an existing process into `perf.data`:
`sudo perf record -p {{pid}}`
* Read `perf.data` (created by `perf record`) and display the profile:
`sudo perf report`"
What is chrt command,,"# chrt
> Manipulate the real-time attributes of a process. More information:
> https://man7.org/linux/man-pages/man1/chrt.1.html.
* Display attributes of a process:
`chrt --pid {{PID}}`
* Display attributes of all threads of a process:
`chrt --all-tasks --pid {{PID}}`
* Display the min/max priority values that can be used with `chrt`:
`chrt --max`
* Set the scheduling policy for a process:
`chrt --pid {{PID}} --{{deadline|idle|batch|rr|fifo|other}}`"
What is git-describe command,,"# git describe
> Give an object a human-readable name based on an available ref. More
> information: https://git-scm.com/docs/git-describe.
* Create a unique name for the current commit (the name contains the most recent annotated tag, the number of additional commits, and the abbreviated commit hash):
`git describe`
* Create a name with 4 digits for the abbreviated commit hash:
`git describe --abbrev={{4}}`
* Generate a name with the tag reference path:
`git describe --all`
* Describe a Git tag:
`git describe {{v1.0.0}}`
* Create a name for the last commit of a given branch:
`git describe {{branch_name}}`"
What is tail command,,"# tail
> Display the last part of a file. See also: `head`. More information:
> https://manned.org/man/freebsd-13.0/tail.1.
* Show last 'count' lines in file:
`tail -n {{8}} {{path/to/file}}`
* Print a file from a specific line number:
`tail -n +{{8}} {{path/to/file}}`
* Print a specific count of bytes from the end of a given file:
`tail -c {{8}} {{path/to/file}}`
* Print the last lines of a given file and keep reading file until `Ctrl + C`:
`tail -f {{path/to/file}}`
* Keep reading file until `Ctrl + C`, even if the file is inaccessible:
`tail -F {{path/to/file}}`
* Show last 'count' lines in 'file' and refresh every 'seconds' seconds:
`tail -n {{8}} -s {{10}} -f {{path/to/file}}`"
What is truncate command,,"# truncate
> Shrink or extend the size of a file to the specified size. More information:
> https://www.gnu.org/software/coreutils/truncate.
* Set a size of 10 GB to an existing file, or create a new file with the specified size:
`truncate --size {{10G}} {{filename}}`
* Extend the file size by 50 MiB, fill with holes (which reads as zero bytes):
`truncate --size +{{50M}} {{filename}}`
* Shrink the file by 2 GiB, by removing data from the end of file:
`truncate --size -{{2G}} {{filename}}`
* Empty the file's content:
`truncate --size 0 {{filename}}`
* Empty the file's content, but do not create the file if it does not exist:
`truncate --no-create --size 0 {{filename}}`"
What is git-check-attr command,,"# git check-attr
> For every pathname, list if each attribute is unspecified, set, or unset as
> a gitattribute on that pathname. More information: https://git-
> scm.com/docs/git-check-attr.
* Check the values of all attributes on a file:
`git check-attr --all {{path/to/file}}`
* Check the value of a specific attribute on a file:
`git check-attr {{attribute}} {{path/to/file}}`
* Check the value of a specific attribute on files:
`git check-attr --all {{path/to/file1}} {{path/to/file2}}`
* Check the value of a specific attribute on one or more files:
`git check-attr {{attribute}} {{path/to/file1}} {{path/to/file2}}`"
What is tr command,,"# tr
> Translate characters: run replacements based on single characters and
> character sets. More information: https://www.gnu.org/software/coreutils/tr.
* Replace all occurrences of a character in a file, and print the result:
`tr {{find_character}} {{replace_character}} < {{path/to/file}}`
* Replace all occurrences of a character from another command's output:
`echo {{text}} | tr {{find_character}} {{replace_character}}`
* Map each character of the first set to the corresponding character of the second set:
`tr '{{abcd}}' '{{jkmn}}' < {{path/to/file}}`
* Delete all occurrences of the specified set of characters from the input:
`tr -d '{{input_characters}}' < {{path/to/file}}`
* Compress a series of identical characters to a single character:
`tr -s '{{input_characters}}' < {{path/to/file}}`
* Translate the contents of a file to upper-case:
`tr ""[:lower:]"" ""[:upper:]"" < {{path/to/file}}`
* Strip out non-printable characters from a file:
`tr -cd ""[:print:]"" < {{path/to/file}}`"
What is cp command,,"# cp
> Copy files and directories. More information:
> https://www.gnu.org/software/coreutils/cp.
* Copy a file to another location:
`cp {{path/to/source_file.ext}} {{path/to/target_file.ext}}`
* Copy a file into another directory, keeping the filename:
`cp {{path/to/source_file.ext}} {{path/to/target_parent_directory}}`
* Recursively copy a directory's contents to another location (if the destination exists, the directory is copied inside it):
`cp -R {{path/to/source_directory}} {{path/to/target_directory}}`
* Copy a directory recursively, in verbose mode (shows files as they are copied):
`cp -vR {{path/to/source_directory}} {{path/to/target_directory}}`
* Copy multiple files at once to a directory:
`cp -t {{path/to/destination_directory}} {{path/to/file1 path/to/file2 ...}}`
* Copy text files to another location, in interactive mode (prompts user before overwriting):
`cp -i {{*.txt}} {{path/to/target_directory}}`
* Follow symbolic links before copying:
`cp -L {{link}} {{path/to/target_directory}}`
* Use the first argument as the destination directory (useful for `xargs ... | cp -t <DEST_DIR>`):
`cp -t {{path/to/target_directory}} {{path/to/file_or_directory1
path/to/file_or_directory2 ...}}`"
What is git-push command,,"# git push
> Push commits to a remote repository. More information: https://git-
> scm.com/docs/git-push.
* Send local changes in the current branch to its default remote counterpart:
`git push`
* Send changes from a specific local branch to its remote counterpart:
`git push {{remote_name}} {{local_branch}}`
* Send changes from a specific local branch to its remote counterpart, and set the remote one as the default push/pull target of the local one:
`git push -u {{remote_name}} {{local_branch}}`
* Send changes from a specific local branch to a specific remote branch:
`git push {{remote_name}} {{local_branch}}:{{remote_branch}}`
* Send changes on all local branches to their counterparts in a given remote repository:
`git push --all {{remote_name}}`
* Delete a branch in a remote repository:
`git push {{remote_name}} --delete {{remote_branch}}`
* Remove remote branches that don't have a local counterpart:
`git push --prune {{remote_name}}`
* Publish tags that aren't yet in the remote repository:
`git push --tags`"
What is lpstat command,,"# lpstat
> Display status information about the current classes, jobs, and printers.
> More information: https://ss64.com/osx/lpstat.html.
* Show a long listing of printers, classes, and jobs:
`lpstat -l`
* Force encryption when connecting to the CUPS server:
`lpstat -E`
* Show the ranking of print jobs:
`lpstat -R`
* Show whether or not the CUPS server is running:
`lpstat -r`
* Show all status information:
`lpstat -t`"
What is find command,,"# find
> Find files or directories under the given directory tree, recursively. More
> information: https://manned.org/find.
* Find files by extension:
`find {{root_path}} -name '{{*.ext}}'`
* Find files matching multiple path/name patterns:
`find {{root_path}} -path '{{**/path/**/*.ext}}' -or -name '{{*pattern*}}'`
* Find directories matching a given name, in case-insensitive mode:
`find {{root_path}} -type d -iname '{{*lib*}}'`
* Find files matching a given pattern, excluding specific paths:
`find {{root_path}} -name '{{*.py}}' -not -path '{{*/site-packages/*}}'`
* Find files matching a given size range, limiting the recursive depth to ""1"":
`find {{root_path}} -maxdepth 1 -size {{+500k}} -size {{-10M}}`
* Run a command for each file (use `{}` within the command to access the filename):
`find {{root_path}} -name '{{*.ext}}' -exec {{wc -l {} }}\;`
* Find files modified in the last 7 days:
`find {{root_path}} -daystart -mtime -{{7}}`
* Find empty (0 byte) files and delete them:
`find {{root_path}} -type {{f}} -empty -delete`"
What is flock command,,"# flock
> Manage locks from shell scripts. It can be used to ensure that only one
> process of a command is running. More information: https://manned.org/flock.
* Run a command with a file lock as soon as the lock is not required by others:
`flock {{path/to/lock.lock}} --command ""{{command}}""`
* Run a command with a file lock, and exit if the lock doesn't exist:
`flock {{path/to/lock.lock}} --nonblock --command ""{{command}}""`
* Run a command with a file lock, and exit with a specific error code if the lock doesn't exist:
`flock {{path/to/lock.lock}} --nonblock --conflict-exit-code {{error_code}} -c
""{{command}}""`"
What is ssh-add command,,"# ssh-add
> Manage loaded ssh keys in the ssh-agent. Ensure that ssh-agent is up and
> running for the keys to be loaded in it. More information:
> https://man.openbsd.org/ssh-add.
* Add the default ssh keys in `~/.ssh` to the ssh-agent:
`ssh-add`
* Add a specific key to the ssh-agent:
`ssh-add {{path/to/private_key}}`
* List fingerprints of currently loaded keys:
`ssh-add -l`
* Delete a key from the ssh-agent:
`ssh-add -d {{path/to/private_key}}`
* Delete all currently loaded keys from the ssh-agent:
`ssh-add -D`
* Add a key to the ssh-agent and the keychain:
`ssh-add -K {{path/to/private_key}}`"
What is git-show-branch command,,"# git show-branch
> Show branches and their commits. More information: https://git-
> scm.com/docs/git-show-branch.
* Show a summary of the latest commit on a branch:
`git show-branch {{branch_name|ref|commit}}`
* Compare commits in the history of multiple commits or branches:
`git show-branch {{branch_name|ref|commit}}`
* Compare all remote tracking branches:
`git show-branch --remotes`
* Compare both local and remote tracking branches:
`git show-branch --all`
* List the latest commits in all branches:
`git show-branch --all --list`
* Compare a given branch with the current branch:
`git show-branch --current {{commit|branch_name|ref}}`
* Display the commit name instead of the relative name:
`git show-branch --sha1-name --current {{current|branch_name|ref}}`
* Keep going a given number of commits past the common ancestor:
`git show-branch --more {{5}} {{commit|branch_name|ref}}
{{commit|branch_name|ref}} {{...}}`"
What is gawk command,,"# gawk
> This command is an alias of GNU `awk`.
* View documentation for the original command:
`tldr -p linux awk`"
What is trap command,,"# trap
> Automatically execute commands after receiving signals by processes or the
> operating system. Can be used to perform cleanups for interruptions by the
> user or other actions. More information: https://manned.org/trap.
* List available signals to set traps for:
`trap -l`
* List active traps for the current shell:
`trap -p`
* Set a trap to execute commands when one or more signals are detected:
`trap 'echo ""Caught signal {{SIGHUP}}""' {{SIGHUP}}`
* Remove active traps:
`trap - {{SIGHUP}} {{SIGINT}}`"
What is git-whatchanged command,,"# git whatchanged
> Show what has changed with recent commits or files. See also `git log`. More
> information: https://git-scm.com/docs/git-whatchanged.
* Display logs and changes for recent commits:
`git whatchanged`
* Display logs and changes for recent commits within the specified time frame:
`git whatchanged --since=""{{2 hours ago}}""`
* Display logs and changes for recent commits for specific files or directories:
`git whatchanged {{path/to/file_or_directory}}`"
What is troff command,,"# troff
> Typesetting processor for the groff (GNU Troff) document formatting system.
> See also `groff`. More information: https://manned.org/troff.
* Format output for a PostScript printer, saving the output to a file:
`troff {{path/to/input.roff}} | grops > {{path/to/output.ps}}`
* Format output for a PostScript printer using the [me] macro package, saving the output to a file:
`troff -{{me}} {{path/to/input.roff}} | grops > {{path/to/output.ps}}`
* Format output as [a]SCII text using the [man] macro package:
`troff -T {{ascii}} -{{man}} {{path/to/input.roff}} | grotty`
* Format output as a [pdf] file, saving the output to a file:
`troff -T {{pdf}} {{path/to/input.roff}} | gropdf > {{path/to/output.pdf}}`"
What is ar command,,"# ar
> Create, modify, and extract from Unix archives. Typically used for static
> libraries (`.a`) and Debian packages (`.deb`). See also: `tar`. More
> information: https://manned.org/ar.
* E[x]tract all members from an archive:
`ar x {{path/to/file.a}}`
* Lis[t] contents in a specific archive:
`ar t {{path/to/file.ar}}`
* [r]eplace or add specific files to an archive:
`ar r {{path/to/file.deb}} {{path/to/debian-binary path/to/control.tar.gz
path/to/data.tar.xz ...}}`
* In[s]ert an object file index (equivalent to using `ranlib`):
`ar s {{path/to/file.a}}`
* Create an archive with specific files and an accompanying object file index:
`ar rs {{path/to/file.a}} {{path/to/file1.o path/to/file2.o ...}}`"
What is hostnamectl command,,"# hostnamectl
> Get or set the hostname of the computer. More information:
> https://manned.org/hostnamectl.
* Get the hostname of the computer:
`hostnamectl`
* Set the hostname of the computer:
`sudo hostnamectl set-hostname ""{{hostname}}""`
* Set a pretty hostname for the computer:
`sudo hostnamectl set-hostname --static ""{{hostname.example.com}}"" && sudo
hostnamectl set-hostname --pretty ""{{hostname}}""`
* Reset hostname to its default value:
`sudo hostnamectl set-hostname --pretty """"`"
What is split command,,"# split
> Split a file into pieces. More information: https://ss64.com/osx/split.html.
* Split a file, each split having 10 lines (except the last split):
`split -l {{10}} {{filename}}`
* Split a file by a regular expression. The matching line will be the first line of the next output file:
`split -p {{cat|^[dh]og}} {{filename}}`
* Split a file with 512 bytes in each split (except the last split; use 512k for kilobytes and 512m for megabytes):
`split -b {{512}} {{filename}}`
* Split a file into 5 files. File is split such that each split has same size (except the last split):
`split -n {{5}} {{filename}}`"
What is sftp command,,"# sftp
> Secure File Transfer Program. Interactive program to copy files between
> hosts over SSH. For non-interactive file transfers, see `scp` or `rsync`.
> More information: https://manned.org/sftp.
* Connect to a remote server and enter an interactive command mode:
`sftp {{remote_user}}@{{remote_host}}`
* Connect using an alternate port:
`sftp -P {{remote_port}} {{remote_user}}@{{remote_host}}`
* Connect using a predefined host (in `~/.ssh/config`):
`sftp {{host}}`
* Transfer remote file to the local system:
`get {{/path/remote_file}}`
* Transfer local file to the remote system:
`put {{/path/local_file}}`
* Transfer remote directory to the local system recursively (works with `put` too):
`get -R {{/path/remote_directory}}`
* Get list of files on local machine:
`lls`
* Get list of files on remote machine:
`ls`"
What is renice command,,"# renice
> Alters the scheduling priority/niceness of one or more running processes.
> Niceness values range from -20 (most favorable to the process) to 19 (least
> favorable to the process). More information: https://manned.org/renice.
* Change priority of a running process:
`renice -n {{niceness_value}} -p {{pid}}`
* Change priority of all processes owned by a user:
`renice -n {{niceness_value}} -u {{user}}`
* Change priority of all processes that belong to a process group:
`renice -n {{niceness_value}} --pgrp {{process_group}}`"
What is envsubst command,,"# envsubst
> Substitutes environment variables with their value in shell format strings.
> Variables to be replaced should be in either `${var}` or `$var` format. More
> information: https://www.gnu.org/software/gettext/manual/html_node/envsubst-
> Invocation.html.
* Replace environment variables in `stdin` and output to `stdout`:
`echo '{{$HOME}}' | envsubst`
* Replace environment variables in an input file and output to `stdout`:
`envsubst < {{path/to/input_file}}`
* Replace environment variables in an input file and output to a file:
`envsubst < {{path/to/input_file}} > {{path/to/output_file}}`
* Replace environment variables in an input file from a space-separated list:
`envsubst '{{$USER $SHELL $HOME}}' < {{path/to/input_file}}`"
What is comm command,,"# comm
> Select or reject lines common to two files. Both files must be sorted. More
> information: https://www.gnu.org/software/coreutils/comm.
* Produce three tab-separated columns: lines only in first file, lines only in second file and common lines:
`comm {{file1}} {{file2}}`
* Print only lines common to both files:
`comm -12 {{file1}} {{file2}}`
* Print only lines common to both files, reading one file from `stdin`:
`cat {{file1}} | comm -12 - {{file2}}`
* Get lines only found in first file, saving the result to a third file:
`comm -23 {{file1}} {{file2}} > {{file1_only}}`
* Print lines only found in second file, when the files aren't sorted:
`comm -13 <(sort {{file1}}) <(sort {{file2}})`"
What is gdb command,,"# gdb
> The GNU Debugger. More information: https://www.gnu.org/software/gdb.
* Debug an executable:
`gdb {{executable}}`
* Attach a process to gdb:
`gdb -p {{procID}}`
* Debug with a core file:
`gdb -c {{core}} {{executable}}`
* Execute given GDB commands upon start:
`gdb -ex ""{{commands}}"" {{executable}}`
* Start `gdb` and pass arguments to the executable:
`gdb --args {{executable}} {{argument1}} {{argument2}}`"
What is git-prune command,,"# git prune
> Git command for pruning all unreachable objects from the object database.
> This command is often not used directly but as an internal command that is
> used by Git gc. More information: https://git-scm.com/docs/git-prune.
* Report what would be removed by Git prune without removing it:
`git prune --dry-run`
* Prune unreachable objects and display what has been pruned to `stdout`:
`git prune --verbose`
* Prune unreachable objects while showing progress:
`git prune --progress`"
What is oomctl command,,"# oomctl
> Analyze the state stored in `systemd-oomd`. More information:
> https://www.freedesktop.org/software/systemd/man/oomctl.html.
* Show the current state of the cgroups and system contexts stored by `systemd-oomd`:
`oomctl dump`"
What is git-config command,,"# git config
> Manage custom configuration options for Git repositories. These
> configurations can be local (for the current repository) or global (for the
> current user). More information: https://git-scm.com/docs/git-config.
* List only local configuration entries (stored in `.git/config` in the current repository):
`git config --list --local`
* List only global configuration entries (stored in `~/.gitconfig` by default or in `$XDG_CONFIG_HOME/git/config` if such a file exists):
`git config --list --global`
* List only system configuration entries (stored in `/etc/gitconfig`), and show their file location:
`git config --list --system --show-origin`
* Get the value of a given configuration entry:
`git config alias.unstage`
* Set the global value of a given configuration entry:
`git config --global alias.unstage ""reset HEAD --""`
* Revert a global configuration entry to its default value:
`git config --global --unset alias.unstage`
* Edit the Git configuration for the current repository in the default editor:
`git config --edit`
* Edit the global Git configuration in the default editor:
`git config --global --edit`"
What is git-merge-base command,,"# git merge-base
> Find a common ancestor of two commits. More information: https://git-
> scm.com/docs/git-merge-base.
* Print the best common ancestor of two commits:
`git merge-base {{commit_1}} {{commit_2}}`
* Output all best common ancestors of two commits:
`git merge-base --all {{commit_1}} {{commit_2}}`
* Check if a commit is an ancestor of a specific commit:
`git merge-base --is-ancestor {{ancestor_commit}} {{commit}}`"
What is pwd command,,"# pwd
> Print name of current/working directory. More information:
> https://www.gnu.org/software/coreutils/pwd.
* Print the current directory:
`pwd`
* Print the current directory, and resolve all symlinks (i.e. show the ""physical"" path):
`pwd -P`"
What is git-unpack-file command,,"# git unpack-file
> Create a temporary file with a blob's contents. More information:
> https://git-scm.com/docs/git-unpack-file.
* Create a file holding the contents of the blob specified by its ID then print the name of the temporary file:
`git unpack-file {{blob_id}}`"
What is git-fsck command,,"# git fsck
> Verify the validity and connectivity of nodes in a Git repository index.
> Does not make any modifications. See `git gc` for cleaning up dangling
> blobs. More information: https://git-scm.com/docs/git-fsck.
* Check the current repository:
`git fsck`
* List all tags found:
`git fsck --tags`
* List all root nodes found:
`git fsck --root`"
What is chgrp command,,"# chgrp
> Change group ownership of files and directories. More information:
> https://www.gnu.org/software/coreutils/chgrp.
* Change the owner group of a file/directory:
`chgrp {{group}} {{path/to/file_or_directory}}`
* Recursively change the owner group of a directory and its contents:
`chgrp -R {{group}} {{path/to/directory}}`
* Change the owner group of a symbolic link:
`chgrp -h {{group}} {{path/to/symlink}}`
* Change the owner group of a file/directory to match a reference file:
`chgrp --reference={{path/to/reference_file}} {{path/to/file_or_directory}}`"
What is free command,,"# free
> Display amount of free and used memory in the system. More information:
> https://manned.org/free.
* Display system memory:
`free`
* Display memory in Bytes/KB/MB/GB:
`free -{{b|k|m|g}}`
* Display memory in human-readable units:
`free -h`
* Refresh the output every 2 seconds:
`free -s {{2}}`"
What is id command,,"# id
> Display current user and group identity. More information:
> https://www.gnu.org/software/coreutils/id.
* Display current user's ID (UID), group ID (GID) and groups to which they belong:
`id`
* Display the current user identity as a number:
`id -u`
* Display the current group identity as a number:
`id -g`
* Display an arbitrary user's ID (UID), group ID (GID) and groups to which they belong:
`id {{username}}`"
What is readelf command,,"# readelf
> Displays information about ELF files. More information:
> http://man7.org/linux/man-pages/man1/readelf.1.html.
* Display all information about the ELF file:
`readelf -all {{path/to/binary}}`
* Display all the headers present in the ELF file:
`readelf --headers {{path/to/binary}}`
* Display the entries in symbol table section of the ELF file, if it has one:
`readelf --symbols {{path/to/binary}}`
* Display the information contained in the ELF header at the start of the file:
`readelf --file-header {{path/to/binary}}`"
What is ld command,,"# ld
> Link object files together. More information:
> https://sourceware.org/binutils/docs-2.38/ld.html.
* Link a specific object file with no dependencies into an executable:
`ld {{path/to/file.o}} --output {{path/to/output_executable}}`
* Link two object files together:
`ld {{path/to/file1.o}} {{path/to/file2.o}} --output
{{path/to/output_executable}}`
* Dynamically link an x86_64 program to glibc (file paths change depending on the system):
`ld --output {{path/to/output_executable}} --dynamic-linker /lib/ld-
linux-x86-64.so.2 /lib/crt1.o /lib/crti.o -lc {{path/to/file.o}} /lib/crtn.o`"
What is git-commit command,,"# git commit
> Commit files to the repository. More information: https://git-
> scm.com/docs/git-commit.
* Commit staged files to the repository with a message:
`git commit --message ""{{message}}""`
* Commit staged files with a message read from a file:
`git commit --file {{path/to/commit_message_file}}`
* Auto stage all modified and deleted files and commit with a message:
`git commit --all --message ""{{message}}""`
* Commit staged files and sign them with the specified GPG key (or the one defined in the config file if no argument is specified):
`git commit --gpg-sign {{key_id}} --message ""{{message}}""`
* Update the last commit by adding the currently staged changes, changing the commit's hash:
`git commit --amend`
* Commit only specific (already staged) files:
`git commit {{path/to/file1}} {{path/to/file2}}`
* Create a commit, even if there are no staged files:
`git commit --message ""{{message}}"" --allow-empty`"
What is xargs command,,"# xargs
> Execute a command with piped arguments coming from another command, a file,
> etc. The input is treated as a single block of text and split into separate
> pieces on spaces, tabs, newlines and end-of-file. More information:
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html.
* Run a command using the input data as arguments:
`{{arguments_source}} | xargs {{command}}`
* Run multiple chained commands on the input data:
`{{arguments_source}} | xargs sh -c ""{{command1}} && {{command2}} |
{{command3}}""`
* Delete all files with a `.backup` extension (`-print0` uses a null character to split file names, and `-0` uses it as delimiter):
`find . -name {{'*.backup'}} -print0 | xargs -0 rm -v`
* Execute the command once for each input line, replacing any occurrences of the placeholder (here marked as `_`) with the input line:
`{{arguments_source}} | xargs -I _ {{command}} _ {{optional_extra_arguments}}`
* Parallel runs of up to `max-procs` processes at a time; the default is 1. If `max-procs` is 0, xargs will run as many processes as possible at a time:
`{{arguments_source}} | xargs -P {{max-procs}} {{command}}`"
What is stty command,,"# stty
> Set options for a terminal device interface. More information:
> https://www.gnu.org/software/coreutils/stty.
* Display all settings for the current terminal:
`stty --all`
* Set the number of rows or columns:
`stty {{rows|cols}} {{count}}`
* Get the actual transfer speed of a device:
`stty --file {{path/to/device_file}} speed`
* Reset all modes to reasonable values for the current terminal:
`stty sane`"
What is git-ls-files command,,"# git ls-files
> Show information about files in the index and the working tree. More
> information: https://git-scm.com/docs/git-ls-files.
* Show deleted files:
`git ls-files --deleted`
* Show modified and deleted files:
`git ls-files --modified`
* Show ignored and untracked files:
`git ls-files --others`
* Show untracked files, not ignored:
`git ls-files --others --exclude-standard`"
What is shred command,,"# shred
> Overwrite files to securely delete data. More information:
> https://www.gnu.org/software/coreutils/shred.
* Overwrite a file:
`shred {{path/to/file}}`
* Overwrite a file, leaving zeroes instead of random data:
`shred --zero {{path/to/file}}`
* Overwrite a file 25 times:
`shred -n25 {{path/to/file}}`
* Overwrite a file and remove it:
`shred --remove {{path/to/file}}`"
What is tac command,,"# tac
> Display and concatenate files with lines in reversed order. See also: `cat`.
> More information: https://www.gnu.org/software/coreutils/tac.
* Concatenate specific files in reversed order:
`tac {{path/to/file1 path/to/file2 ...}}`
* Display `stdin` in reversed order:
`{{cat path/to/file}} | tac`
* Use a specific [s]eparator:
`tac -s {{separator}} {{path/to/file1 path/to/file2 ...}}`
* Use a specific [r]egex as a [s]eparator:
`tac -r -s {{separator}} {{path/to/file1 path/to/file2 ...}}`
* Use a separator [b]efore each file:
`tac -b {{path/to/file1 path/to/file2 ...}}`"
What is write command,,"# write
> Write a message on the terminal of a specified logged in user (ctrl-C to
> stop writing messages). Use the `who` command to find out all terminal_ids
> of all active users active on the system. See also `mesg`. More information:
> https://manned.org/write.
* Send a message to a given user on a given terminal id:
`write {{username}} {{terminal_id}}`
* Send message to ""testuser"" on terminal `/dev/tty/5`:
`write {{testuser}} {{tty/5}}`
* Send message to ""johndoe"" on pseudo terminal `/dev/pts/5`:
`write {{johndoe}} {{pts/5}}`"
What is git-ls-remote command,,"# git ls-remote
> Git command for listing references in a remote repository based on name or
> URL. If no name or URL are given, then the configured upstream branch will
> be used, or remote origin if the former is not configured. More information:
> https://git-scm.com/docs/git-ls-remote.
* Show all references in the default remote repository:
`git ls-remote`
* Show only heads references in the default remote repository:
`git ls-remote --heads`
* Show only tags references in the default remote repository:
`git ls-remote --tags`
* Show all references from a remote repository based on name or URL:
`git ls-remote {{repository_url}}`
* Show references from a remote repository filtered by a pattern:
`git ls-remote {{repository_name}} ""{{pattern}}""`"
What is git-merge command,,"# git merge
> Merge branches. More information: https://git-scm.com/docs/git-merge.
* Merge a branch into your current branch:
`git merge {{branch_name}}`
* Edit the merge message:
`git merge --edit {{branch_name}}`
* Merge a branch and create a merge commit:
`git merge --no-ff {{branch_name}}`
* Abort a merge in case of conflicts:
`git merge --abort`
* Merge using a specific strategy:
`git merge --strategy {{strategy}} --strategy-option {{strategy_option}}
{{branch_name}}`"
What is chown command,,"# chown
> Change user and group ownership of files and directories. More information:
> https://www.gnu.org/software/coreutils/chown.
* Change the owner user of a file/directory:
`chown {{user}} {{path/to/file_or_directory}}`
* Change the owner user and group of a file/directory:
`chown {{user}}:{{group}} {{path/to/file_or_directory}}`
* Recursively change the owner of a directory and its contents:
`chown -R {{user}} {{path/to/directory}}`
* Change the owner of a symbolic link:
`chown -h {{user}} {{path/to/symlink}}`
* Change the owner of a file/directory to match a reference file:
`chown --reference={{path/to/reference_file}} {{path/to/file_or_directory}}`"
What is sshfs command,,"# sshfs
> Filesystem client based on SSH. More information:
> https://github.com/libfuse/sshfs.
* Mount remote directory:
`sshfs {{username}}@{{remote_host}}:{{remote_directory}} {{mountpoint}}`
* Unmount remote directory:
`umount {{mountpoint}}`
* Mount remote directory from server with specific port:
`sshfs {{username}}@{{remote_host}}:{{remote_directory}} -p {{2222}}`
* Use compression:
`sshfs {{username}}@{{remote_host}}:{{remote_directory}} -C`
* Follow symbolic links:
`sshfs -o follow_symlinks {{username}}@{{remote_host}}:{{remote_directory}}
{{mountpoint}}`"
What is sleep command,,"# sleep
> Delay for a specified amount of time. More information:
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sleep.html.
* Delay in seconds:
`sleep {{seconds}}`
* Execute a specific command after 20 seconds delay:
`sleep 20 && {{command}}`"
What is manpath command,,"# manpath
> Determine the search path for manual pages. More information:
> https://manned.org/manpath.
* Display the search path used to find man pages:
`manpath`
* Show the entire global manpath:
`manpath --global`"
What is mv command,,"# mv
> Move or rename files and directories. More information:
> https://www.gnu.org/software/coreutils/mv.
* Rename a file or directory when the target is not an existing directory:
`mv {{path/to/source}} {{path/to/target}}`
* Move a file or directory into an existing directory:
`mv {{path/to/source}} {{path/to/existing_directory}}`
* Move multiple files into an existing directory, keeping the filenames unchanged:
`mv {{path/to/source1 path/to/source2 ...}} {{path/to/existing_directory}}`
* Do not prompt for confirmation before overwriting existing files:
`mv -f {{path/to/source}} {{path/to/target}}`
* Prompt for confirmation before overwriting existing files, regardless of file permissions:
`mv -i {{path/to/source}} {{path/to/target}}`
* Do not overwrite existing files at the target:
`mv -n {{path/to/source}} {{path/to/target}}`
* Move files in verbose mode, showing files after they are moved:
`mv -v {{path/to/source}} {{path/to/target}}`"
What is whereis command,,"# whereis
> Locate the binary, source, and manual page files for a command. More
> information: https://manned.org/whereis.
* Locate binary, source and man pages for ssh:
`whereis {{ssh}}`
* Locate binary and man pages for ls:
`whereis -bm {{ls}}`
* Locate source of gcc and man pages for Git:
`whereis -s {{gcc}} -m {{git}}`
* Locate binaries for gcc in `/usr/bin/` only:
`whereis -b -B {{/usr/bin/}} -f {{gcc}}`
* Locate unusual binaries (those that have more or less than one binary on the system):
`whereis -u *`
* Locate binaries that have unusual manual entries (binaries that have more or less than one manual installed):
`whereis -u -m *`"
What is git-daemon command,,"# git daemon
> A really simple server for Git repositories. More information: https://git-
> scm.com/docs/git-daemon.
* Launch a Git daemon with a whitelisted set of directories:
`git daemon --export-all {{path/to/directory1}} {{path/to/directory2}}`
* Launch a Git daemon with a specific base directory and allow pulling from all sub-directories that look like Git repositories:
`git daemon --base-path={{path/to/directory}} --export-all --reuseaddr`
* Launch a Git daemon for the specified directory, verbosely printing log messages and allowing Git clients to write to it:
`git daemon {{path/to/directory}} --enable=receive-pack --informative-errors
--verbose`"