instruction
stringlengths 17
36
| input
stringclasses 1
value | output
stringlengths 101
1.77k
|
---|---|---|
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}}`
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.