instruction
stringlengths 17
36
| input
stringclasses 1
value | output
stringlengths 101
1.77k
|
---|---|---|
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` |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.