instruction
stringlengths 17
36
| input
stringclasses 1
value | output
stringlengths 101
1.77k
|
---|---|---|
What is git-reflog command | # git reflog
> Show a log of changes to local references like HEAD, branches or tags. More
> information: https://git-scm.com/docs/git-reflog.
* Show the reflog for HEAD:
`git reflog`
* Show the reflog for a given branch:
`git reflog {{branch_name}}`
* Show only the 5 latest entries in the reflog:
`git reflog -n {{5}}` |
|
What is git-cat-file command | # git cat-file
> Provide content or type and size information for Git repository objects.
> More information: https://git-scm.com/docs/git-cat-file.
* Get the [s]ize of the HEAD commit in bytes:
`git cat-file -s HEAD`
* Get the [t]ype (blob, tree, commit, tag) of a given Git object:
`git cat-file -t {{8c442dc3}}`
* Pretty-[p]rint the contents of a given Git object based on its type:
`git cat-file -p {{HEAD~2}}` |
|
What is clear command | # clear
> Clears the screen of the terminal. More information:
> https://manned.org/clear.
* Clear the screen (equivalent to pressing Control-L in Bash shell):
`clear`
* Clear the screen but keep the terminal's scrollback buffer:
`clear -x`
* Indicate the type of terminal to clean (defaults to the value of the environment variable `TERM`):
`clear -T {{type_of_terminal}}`
* Show the version of `ncurses` used by `clear`:
`clear -V` |
|
What is tput command | # tput
> View and modify terminal settings and capabilities. More information:
> https://manned.org/tput.
* Move the cursor to a screen location:
`tput cup {{row}} {{column}}`
* Set foreground (af) or background (ab) color:
`tput {{setaf|setab}} {{ansi_color_code}}`
* Show number of columns, lines, or colors:
`tput {{cols|lines|colors}}`
* Ring the terminal bell:
`tput bel`
* Reset all terminal attributes:
`tput sgr0`
* Enable or disable word wrap:
`tput {{smam|rmam}}` |
|
What is nice command | # nice
> Execute a program with a custom scheduling priority (niceness). Niceness
> values range from -20 (the highest priority) to 19 (the lowest). More
> information: https://www.gnu.org/software/coreutils/nice.
* Launch a program with altered priority:
`nice -n {{niceness_value}} {{command}}` |
|
What is echo command | # echo
> Print given arguments. More information:
> https://www.gnu.org/software/coreutils/echo.
* Print a text message. Note: quotes are optional:
`echo "{{Hello World}}"`
* Print a message with environment variables:
`echo "{{My path is $PATH}}"`
* Print a message without the trailing newline:
`echo -n "{{Hello World}}"`
* Append a message to the file:
`echo "{{Hello World}}" >> {{file.txt}}`
* Enable interpretation of backslash escapes (special characters):
`echo -e "{{Column 1\tColumn 2}}"`
* Print the exit status of the last executed command (Note: In Windows Command Prompt and PowerShell the equivalent commands are `echo %errorlevel%` and `$lastexitcode` respectively):
`echo $?` |
|
What is expand command | # expand
> Convert tabs to spaces. More information:
> https://www.gnu.org/software/coreutils/expand.
* Convert tabs in each file to spaces, writing to `stdout`:
`expand {{path/to/file}}`
* Convert tabs to spaces, reading from `stdin`:
`expand`
* Do not convert tabs after non blanks:
`expand -i {{path/to/file}}`
* Have tabs a certain number of characters apart, not 8:
`expand -t={{number}} {{path/to/file}}`
* Use a comma separated list of explicit tab positions:
`expand -t={{1,4,6}}` |
|
What is systemd-firstboot command | # systemd-firstboot
> Initialize basic system settings on or before the first boot-up of a system.
> More information: https://www.freedesktop.org/software/systemd/man/systemd-
> firstboot.html.
* Operate on the specified directory instead of the root directory of the host system:
`sudo systemd-firstboot --root={{path/to/root_directory}}`
* Set the system keyboard layout:
`sudo systemd-firstboot --keymap={{keymap}}`
* Set the system hostname:
`sudo systemd-firstboot --hostname={{hostname}}`
* Set the root user's password:
`sudo systemd-firstboot --root-password={{password}}`
* Prompt the user interactively for a specific basic setting:
`sudo systemd-firstboot --prompt={{setting}}`
* Force writing configuration even if the relevant files already exist:
`sudo systemd-firstboot --force`
* Remove all existing files that are configured by `systemd-firstboot`:
`sudo systemd-firstboot --reset`
* Remove the password of the system's root user:
`sudo systemd-firstboot --delete-root-password` |
|
What is last command | # last
> View the last logged in users. More information: https://manned.org/last.
* View last logins, their duration and other information as read from `/var/log/wtmp`:
`last`
* Specify how many of the last logins to show:
`last -n {{login_count}}`
* Print the full date and time for entries and then display the hostname column last to prevent truncation:
`last -F -a`
* View all logins by a specific user and show the IP address instead of the hostname:
`last {{username}} -i`
* View all recorded reboots (i.e., the last logins of the pseudo user "reboot"):
`last reboot`
* View all recorded shutdowns (i.e., the last logins of the pseudo user "shutdown"):
`last shutdown` |
|
What is flatpak command | # flatpak
> Build, install and run flatpak applications and runtimes. More information:
> https://docs.flatpak.org/en/latest/flatpak-command-reference.html#flatpak.
* Run an installed application:
`flatpak run {{name}}`
* Install an application from a remote source:
`flatpak install {{remote}} {{name}}`
* List all installed applications and runtimes:
`flatpak list`
* Update all installed applications and runtimes:
`flatpak update`
* Add a remote source:
`flatpak remote-add --if-not-exists {{remote_name}} {{remote_url}}`
* Remove an installed application:
`flatpak remove {{name}}`
* Remove all unused applications:
`flatpak remove --unused`
* Show information about an installed application:
`flatpak info {{name}}` |
|
What is cksum command | # cksum
> Calculates CRC checksums and byte counts of a file. Note, on old UNIX
> systems the CRC implementation may differ. More information:
> https://www.gnu.org/software/coreutils/cksum.
* Display a 32-bit checksum, size in bytes and filename:
`cksum {{path/to/file}}` |
|
What is git-for-each-repo command | # git for-each-repo
> Run a Git command on a list of repositories. Note: this command is
> experimental and may change. More information: https://git-scm.com/docs/git-
> for-each-repo.
* Run maintenance on each of a list of repositories stored in the `maintenance.repo` user configuration variable:
`git for-each-repo --config={{maintenance.repo}} {{maintenance run}}`
* Run `git pull` on each repository listed in a global configuration variable:
`git for-each-repo --config={{global_configuration_variable}} {{pull}}` |
|
What is more command | # more
> Open a file for interactive reading, allowing scrolling and search. More
> information: https://manned.org/more.
* Open a file:
`more {{path/to/file}}`
* Open a file displaying from a specific line:
`more +{{line_number}} {{path/to/file}}`
* Display help:
`more --help`
* Go to the next page:
`<Space>`
* Search for a string (press `n` to go to the next match):
`/{{something}}`
* Exit:
`q`
* Display help about interactive commands:
`h` |
|
What is apropos command | # apropos
> Search the manual pages for names and descriptions. More information:
> https://manned.org/apropos.
* Search for a keyword using a regular expression:
`apropos {{regular_expression}}`
* Search without restricting the output to the terminal width:
`apropos -l {{regular_expression}}`
* Search for pages that contain all the expressions given:
`apropos {{regular_expression_1}} -a {{regular_expression_2}} -a
{{regular_expression_3}}` |
|
What is cat command | # cat
> Print and concatenate files. More information:
> https://keith.github.io/xcode-man-pages/cat.1.html.
* Print the contents of a file to `stdout`:
`cat {{path/to/file}}`
* Concatenate several files into an output file:
`cat {{path/to/file1 path/to/file2 ...}} > {{path/to/output_file}}`
* Append several files to an output file:
`cat {{path/to/file1 path/to/file2 ...}} >> {{path/to/output_file}}`
* Copy the contents of a file into an output file without buffering:
`cat -u {{/dev/tty12}} > {{/dev/tty13}}`
* Write `stdin` to a file:
`cat - > {{path/to/file}}`
* Number all output lines:
`cat -n {{path/to/file}}`
* Display non-printable and whitespace characters (with `M-` prefix if non-ASCII):
`cat -v -t -e {{path/to/file}}` |
|
What is arch command | # arch
> Display the name of the system architecture, or run a command under a
> different architecture. See also `uname`. More information:
> https://www.unix.com/man-page/osx/1/arch/.
* Display the system's architecture:
`arch`
* Run a command using x86_64:
`arch -x86_64 "{{command}}"`
* Run a command using arm:
`arch -arm64 "{{command}}"` |
|
What is update-alternatives command | # update-alternatives
> A convenient tool for maintaining symbolic links to determine default
> commands. More information: https://manned.org/update-alternatives.
* Add a symbolic link:
`sudo update-alternatives --install {{path/to/symlink}} {{command_name}}
{{path/to/command_binary}} {{priority}}`
* Configure a symbolic link for `java`:
`sudo update-alternatives --config {{java}}`
* Remove a symbolic link:
`sudo update-alternatives --remove {{java}}
{{/opt/java/jdk1.8.0_102/bin/java}}`
* Display information about a specified command:
`update-alternatives --display {{java}}`
* Display all commands and their current selection:
`update-alternatives --get-selections` |
|
What is mailx command | # mailx
> Send and receive mail. More information: https://manned.org/mailx.
* Send mail (the content should be typed after the command, and ended with `Ctrl+D`):
`mailx -s "{{subject}}" {{to_addr}}`
* Send mail with content passed from another command:
`echo "{{content}}" | mailx -s "{{subject}}" {{to_addr}}`
* Send mail with content read from a file:
`mailx -s "{{subject}}" {{to_addr}} < {{content.txt}}`
* Send mail to a recipient and CC to another address:
`mailx -s "{{subject}}" -c {{cc_addr}} {{to_addr}}`
* Send mail specifying the sender address:
`mailx -s "{{subject}}" -r {{from_addr}} {{to_addr}}`
* Send mail with an attachment:
`mailx -a {{path/to/file}} -s "{{subject}}" {{to_addr}}` |
|
What is dot command | # dot
> Render an image of a `linear directed` network graph from a `graphviz` file.
> Layouts: `dot`, `neato`, `twopi`, `circo`, `fdp`, `sfdp`, `osage` &
> `patchwork`. More information: https://graphviz.org/doc/info/command.html.
* Render a `png` image with a filename based on the input filename and output format (uppercase -O):
`dot -T {{png}} -O {{path/to/input.gv}}`
* Render a `svg` image with the specified output filename (lowercase -o):
`dot -T {{svg}} -o {{path/to/image.svg}} {{path/to/input.gv}}`
* Render the output in `ps`, `pdf`, `svg`, `fig`, `png`, `gif`, `jpg`, `json`, or `dot` format:
`dot -T {{format}} -O {{path/to/input.gv}}`
* Render a `gif` image using `stdin` and `stdout`:
`echo "{{digraph {this -> that} }}" | dot -T {{gif}} > {{path/to/image.gif}}`
* Display help:
`dot -?` |
|
What is gcc command | # gcc
> Preprocess and compile C and C++ source files, then assemble and link them
> together. More information: https://gcc.gnu.org.
* Compile multiple source files into an executable:
`gcc {{path/to/source1.c path/to/source2.c ...}} -o
{{path/to/output_executable}}`
* Show common warnings, debug symbols in output, and optimize without affecting debugging:
`gcc {{path/to/source.c}} -Wall -g -Og -o {{path/to/output_executable}}`
* Include libraries from a different path:
`gcc {{path/to/source.c}} -o {{path/to/output_executable}}
-I{{path/to/header}} -L{{path/to/library}} -l{{library_name}}`
* Compile source code into Assembler instructions:
`gcc -S {{path/to/source.c}}`
* Compile source code into an object file without linking:
`gcc -c {{path/to/source.c}}` |
|
What is whoami command | # whoami
> Print the username associated with the current effective user ID. More
> information: https://www.gnu.org/software/coreutils/whoami.
* Display currently logged username:
`whoami`
* Display the username after a change in the user ID:
`sudo whoami` |
|
What is gitk command | # gitk
> A graphical Git repository browser. More information: https://git-
> scm.com/docs/gitk.
* Show the repository browser for the current Git repository:
`gitk`
* Show repository browser for a specific file or directory:
`gitk {{path/to/file_or_directory}}`
* Show commits made since 1 week ago:
`gitk --since="{{1 week ago}}"`
* Show commits older than 1/1/2016:
`gitk --until="{{1/1/2015}}"`
* Show at most 100 changes in all branches:
`gitk --max-count={{100}} --all` |
|
What is realpath command | # realpath
> Display the resolved absolute path for a file or directory. More
> information: https://www.gnu.org/software/coreutils/realpath.
* Display the absolute path for a file or directory:
`realpath {{path/to/file_or_directory}}`
* Require all path components to exist:
`realpath --canonicalize-existing {{path/to/file_or_directory}}`
* Resolve ".." components before symlinks:
`realpath --logical {{path/to/file_or_directory}}`
* Disable symlink expansion:
`realpath --no-symlinks {{path/to/file_or_directory}}`
* Suppress error messages:
`realpath --quiet {{path/to/file_or_directory}}` |
|
What is csplit command | # csplit
> Split a file into pieces. This generates files named "xx00", "xx01", and so
> on. More information: https://www.gnu.org/software/coreutils/csplit.
* Split a file at lines 5 and 23:
`csplit {{path/to/file}} {{5}} {{23}}`
* Split a file every 5 lines (this will fail if the total number of lines is not divisible by 5):
`csplit {{path/to/file}} {{5}} {*}`
* Split a file every 5 lines, ignoring exact-division error:
`csplit -k {{path/to/file}} {{5}} {*}`
* Split a file at line 5 and use a custom prefix for the output files:
`csplit {{path/to/file}} {{5}} -f {{prefix}}`
* Split a file at a line matching a regular expression:
`csplit {{path/to/file}} /{{regular_expression}}/` |
|
What is ps command | # ps
> Information about running processes. More information:
> https://www.unix.com/man-page/osx/1/ps/.
* List all running processes:
`ps aux`
* List all running processes including the full command string:
`ps auxww`
* Search for a process that matches a string:
`ps aux | grep {{string}}`
* Get the parent PID of a process:
`ps -o ppid= -p {{pid}}`
* Sort processes by memory usage:
`ps -m`
* Sort processes by CPU usage:
`ps -r` |
|
What is journalctl command | # journalctl
> Query the systemd journal. More information: https://manned.org/journalctl.
* Show all messages with priority level 3 (errors) from this [b]oot:
`journalctl -b --priority={{3}}`
* Show all messages from last [b]oot:
`journalctl -b -1`
* Delete journal logs which are older than 2 days:
`journalctl --vacuum-time={{2d}}`
* [f]ollow new messages (like `tail -f` for traditional syslog):
`journalctl -f`
* Show all messages by a specific [u]nit:
`journalctl -u {{unit}}`
* Filter messages within a time range (either timestamp or placeholders like "yesterday"):
`journalctl --since {{now|today|yesterday|tomorrow}} --until {{YYYY-MM-DD
HH:MM:SS}}`
* Show all messages by a specific process:
`journalctl _PID={{pid}}`
* Show all messages by a specific executable:
`journalctl {{path/to/executable}}` |
|
What is head command | # head
> Output the first part of files. More information:
> https://keith.github.io/xcode-man-pages/head.1.html.
* Output the first few lines of a file:
`head --lines {{8}} {{path/to/file}}`
* Output the first few bytes of a file:
`head --bytes {{8}} {{path/to/file}}`
* Output everything but the last few lines of a file:
`head --lines -{{8}} {{path/to/file}}`
* Output everything but the last few bytes of a file:
`head --bytes -{{8}} {{path/to/file}}` |
|
What is basename command | # basename
> Remove leading directory portions from a path. More information:
> https://www.gnu.org/software/coreutils/basename.
* Show only the file name from a path:
`basename {{path/to/file}}`
* Show only the rightmost directory name from a path:
`basename {{path/to/directory/}}`
* Show only the file name from a path, with a suffix removed:
`basename {{path/to/file}} {{suffix}}` |
|
What is git-maintenance command | # git-maintenance
> Run tasks to optimize Git repository data. More information: https://git-
> scm.com/docs/git-maintenance.
* Register the current repository in the user's list of repositories to daily have maintenance run:
`git maintenance register`
* Start running maintenance on the current repository:
`git maintenance start`
* Halt the background maintenance schedule for the current repository:
`git maintenance stop`
* Remove the current repository from the user's maintenance repository list:
`git maintenance unregister`
* Run a specific maintenance task on the current repository:
`git maintenance run --task={{commit-graph|gc|incremental-repack|loose-
objects|pack-refs|prefetch}}` |
|
What is git-diff-files command | # git diff-files
> Compare files using their sha1 hashes and modes. More information:
> https://git-scm.com/docs/git-diff-files.
* Compare all changed files:
`git diff-files`
* Compare only specified files:
`git diff-files {{path/to/file}}`
* Show only the names of changed files:
`git diff-files --name-only`
* Output a summary of extended header information:
`git diff-files --summary` |
|
What is expr command | # expr
> Evaluate expressions and manipulate strings. More information:
> https://www.gnu.org/software/coreutils/expr.
* Get the length of a specific string:
`expr length "{{string}}"`
* Get the substring of a string with a specific length:
`expr substr "{{string}}" {{from}} {{length}}`
* Match a specific substring against an anchored pattern:
`expr match "{{string}}" '{{pattern}}'`
* Get the first char position from a specific set in a string:
`expr index "{{string}}" "{{chars}}"`
* Calculate a specific mathematic expression:
`expr {{expression1}} {{+|-|*|/|%}} {{expression2}}`
* Get the first expression if its value is non-zero and not null otherwise get the second one:
`expr {{expression1}} \| {{expression2}}`
* Get the first expression if both expressions are non-zero and not null otherwise get zero:
`expr {{expression1}} \& {{expression2}}` |
|
What is mv command | # mv
> Move or rename files and directories. More information:
> https://www.gnu.org/software/coreutils/mv.
* Rename a file or directory when the target is not an existing directory:
`mv {{path/to/source}} {{path/to/target}}`
* Move a file or directory into an existing directory:
`mv {{path/to/source}} {{path/to/existing_directory}}`
* Move multiple files into an existing directory, keeping the filenames unchanged:
`mv {{path/to/source1 path/to/source2 ...}} {{path/to/existing_directory}}`
* Do not prompt for confirmation before overwriting existing files:
`mv -f {{path/to/source}} {{path/to/target}}`
* Prompt for confirmation before overwriting existing files, regardless of file permissions:
`mv -i {{path/to/source}} {{path/to/target}}`
* Do not overwrite existing files at the target:
`mv -n {{path/to/source}} {{path/to/target}}`
* Move files in verbose mode, showing files after they are moved:
`mv -v {{path/to/source}} {{path/to/target}}` |
|
What is loginctl command | # loginctl
> Manage the systemd login manager. More information:
> https://www.freedesktop.org/software/systemd/man/loginctl.html.
* Print all current sessions:
`loginctl list-sessions`
* Print all properties of a specific session:
`loginctl show-session {{session_id}} --all`
* Print all properties of a specific user:
`loginctl show-user {{username}}`
* Print a specific property of a user:
`loginctl show-user {{username}} --property={{property_name}}`
* Execute a `loginctl` operation on a remote host:
`loginctl list-users -H {{hostname}}` |
|
What is cut command | # cut
> Cut out fields from `stdin` or files. More information:
> https://manned.org/man/freebsd-13.0/cut.1.
* Print a specific character/field range of each line:
`{{command}} | cut -{{c|f}} {{1|1,10|1-10|1-|-10}}`
* Print a range of each line with a specific delimiter:
`{{command}} | cut -d "{{,}}" -{{c}} {{1}}`
* Print a range of each line of a specific file:
`cut -{{c}} {{1}} {{path/to/file}}` |
|
What is kill command | # kill
> Sends a signal to a process, usually related to stopping the process. All
> signals except for SIGKILL and SIGSTOP can be intercepted by the process to
> perform a clean exit. More information: https://manned.org/kill.
* Terminate a program using the default SIGTERM (terminate) signal:
`kill {{process_id}}`
* List available signal names (to be used without the `SIG` prefix):
`kill -l`
* Terminate a background job:
`kill %{{job_id}}`
* Terminate a program using the SIGHUP (hang up) signal. Many daemons will reload instead of terminating:
`kill -{{1|HUP}} {{process_id}}`
* Terminate a program using the SIGINT (interrupt) signal. This is typically initiated by the user pressing `Ctrl + C`:
`kill -{{2|INT}} {{process_id}}`
* Signal the operating system to immediately terminate a program (which gets no chance to capture the signal):
`kill -{{9|KILL}} {{process_id}}`
* Signal the operating system to pause a program until a SIGCONT ("continue") signal is received:
`kill -{{17|STOP}} {{process_id}}`
* Send a `SIGUSR1` signal to all processes with the given GID (group id):
`kill -{{SIGUSR1}} -{{group_id}}` |
|
What is sleep command | # sleep
> Delay for a specified amount of time. More information:
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sleep.html.
* Delay in seconds:
`sleep {{seconds}}`
* Execute a specific command after 20 seconds delay:
`sleep 20 && {{command}}` |
|
What is printf command | # printf
> Format and print text. More information:
> https://www.gnu.org/software/coreutils/printf.
* Print a text message:
`printf "{{%s\n}}" "{{Hello world}}"`
* Print an integer in bold blue:
`printf "{{\e[1;34m%.3d\e[0m\n}}" {{42}}`
* Print a float number with the Unicode Euro sign:
`printf "{{\u20AC %.2f\n}}" {{123.4}}`
* Print a text message composed with environment variables:
`printf "{{var1: %s\tvar2: %s\n}}" "{{$VAR1}}" "{{$VAR2}}"`
* Store a formatted message in a variable (does not work on zsh):
`printf -v {{myvar}} {{"This is %s = %d\n" "a year" 2016}}` |
|
What is c99 command | # c99
> Compiles C programs according to the ISO C standard. More information:
> https://manned.org/c99.
* Compile source file(s) and create an executable:
`c99 {{file.c}}`
* Compile source file(s) and create an executable with a custom name:
`c99 -o {{executable_name}} {{file.c}}`
* Compile source file(s) and create object file(s):
`c99 -c {{file.c}}`
* Compile source file(s), link with object file(s), and create an executable:
`c99 {{file.c}} {{file.o}}` |
|
What is runuser command | # runuser
> Run commands as a specific user and group without asking for password (needs
> root privileges). More information: https://manned.org/runuser.
* Run command as a different user:
`runuser {{user}} -c '{{command}}'`
* Run command as a different user and group:
`runuser {{user}} -g {{group}} -c '{{command}}'`
* Start a login shell as a specific user:
`runuser {{user}} -l`
* Specify a shell for running instead of the default shell (also works for login):
`runuser {{user}} -s {{/bin/sh}}`
* Preserve the entire environment of root (only if `--login` is not specified):
`runuser {{user}} --preserve-environment -c '{{command}}'` |
|
What is man command | # man
> Format and display manual pages. More information:
> https://www.man7.org/linux/man-pages/man1/man.1.html.
* Display the man page for a command:
`man {{command}}`
* Display the man page for a command from section 7:
`man {{7}} {{command}}`
* List all available sections for a command:
`man -f {{command}}`
* Display the path searched for manpages:
`man --path`
* Display the location of a manpage rather than the manpage itself:
`man -w {{command}}`
* Display the man page using a specific locale:
`man {{command}} --locale={{locale}}`
* Search for manpages containing a search string:
`man -k "{{search_string}}"` |
|
What is git-cherry command | # git cherry
> Find commits that have yet to be applied upstream. More information:
> https://git-scm.com/docs/git-cherry.
* Show commits (and their messages) with equivalent commits upstream:
`git cherry -v`
* Specify a different upstream and topic branch:
`git cherry {{origin}} {{topic}}`
* Limit commits to those within a given limit:
`git cherry {{origin}} {{topic}} {{base}}` |
|
What is fold command | # fold
> Wrap each line in an input file to fit a specified width and print it to
> `stdout`. More information: https://manned.org/fold.1p.
* Wrap each line to default width (80 characters):
`fold {{path/to/file}}`
* Wrap each line to width "30":
`fold -w30 {{path/to/file}}`
* Wrap each line to width "5" and break the line at spaces (puts each space separated word in a new line, words with length > 5 are wrapped):
`fold -w5 -s {{path/to/file}}` |
|
What is dirname command | # dirname
> Calculates the parent directory of a given file or directory path. More
> information: https://www.gnu.org/software/coreutils/dirname.
* Calculate the parent directory of a given path:
`dirname {{path/to/file_or_directory}}`
* Calculate the parent directory of multiple paths:
`dirname {{path/to/file_a}} {{path/to/directory_b}}`
* Delimit output with a NUL character instead of a newline (useful when combining with `xargs`):
`dirname --zero {{path/to/directory_a}} {{path/to/file_b}}` |
|
What is tsort command | # tsort
> Perform a topological sort. A common use is to show the dependency order of
> nodes in a directed acyclic graph. More information:
> https://www.gnu.org/software/coreutils/tsort.
* Perform a topological sort consistent with a partial sort per line of input separated by blanks:
`tsort {{path/to/file}}`
* Perform a topological sort consistent on strings:
`echo -e "{{UI Backend\nBackend Database\nDocs UI}}" | tsort` |
|
What is base32 command | # base32
> Encode or decode file or `stdin` to/from Base32, to `stdout`. More
> information: https://www.gnu.org/software/coreutils/base32.
* Encode a file:
`base32 {{path/to/file}}`
* Decode a file:
`base32 --decode {{path/to/file}}`
* Encode from `stdin`:
`{{somecommand}} | base32`
* Decode from `stdin`:
`{{somecommand}} | base32 --decode` |
|
What is git-commit-tree command | # git commit-tree
> Low level utility to create commit objects. See also: `git commit`. More
> information: https://git-scm.com/docs/git-commit-tree.
* Create a commit object with the specified message:
`git commit-tree {{tree}} -m "{{message}}"`
* Create a commit object reading the message from a file (use `-` for `stdin`):
`git commit-tree {{tree}} -F {{path/to/file}}`
* Create a GPG-signed commit object:
`git commit-tree {{tree}} -m "{{message}}" --gpg-sign`
* Create a commit object with the specified parent commit object:
`git commit-tree {{tree}} -m "{{message}}" -p {{parent_commit_sha}}` |
|
What is reset command | # reset
> Reinitializes the current terminal. Clears the entire terminal screen. More
> information: https://manned.org/reset.
* Reinitialize the current terminal:
`reset`
* Display the terminal type instead:
`reset -q` |
|
What is git-init command | # git init
> Initializes a new local Git repository. More information: https://git-
> scm.com/docs/git-init.
* Initialize a new local repository:
`git init`
* Initialize a repository with the specified name for the initial branch:
`git init --initial-branch={{branch_name}}`
* Initialize a repository using SHA256 for object hashes (requires Git version 2.29+):
`git init --object-format={{sha256}}`
* Initialize a barebones repository, suitable for use as a remote over ssh:
`git init --bare` |
|
What is csplit command | # csplit
> Split a file into pieces. This generates files named "xx00", "xx01", and so
> on. More information: https://www.gnu.org/software/coreutils/csplit.
* Split a file at lines 5 and 23:
`csplit {{path/to/file}} {{5}} {{23}}`
* Split a file every 5 lines (this will fail if the total number of lines is not divisible by 5):
`csplit {{path/to/file}} {{5}} {*}`
* Split a file every 5 lines, ignoring exact-division error:
`csplit -k {{path/to/file}} {{5}} {*}`
* Split a file at line 5 and use a custom prefix for the output files:
`csplit {{path/to/file}} {{5}} -f {{prefix}}`
* Split a file at a line matching a regular expression:
`csplit {{path/to/file}} /{{regular_expression}}/` |
|
What is make command | # make
> Task runner for targets described in Makefile. Mostly used to control the
> compilation of an executable from source code. More information:
> https://www.gnu.org/software/make/manual/make.html.
* Call the first target specified in the Makefile (usually named "all"):
`make`
* Call a specific target:
`make {{target}}`
* Call a specific target, executing 4 jobs at a time in parallel:
`make -j{{4}} {{target}}`
* Use a specific Makefile:
`make --file {{path/to/file}}`
* Execute make from another directory:
`make --directory {{path/to/directory}}`
* Force making of a target, even if source files are unchanged:
`make --always-make {{target}}`
* Override a variable defined in the Makefile:
`make {{target}} {{variable}}={{new_value}}`
* Override variables defined in the Makefile by the environment:
`make --environment-overrides {{target}}` |
|
What is sed command | # sed
> Edit text in a scriptable manner. See also: `awk`, `ed`. More information:
> https://keith.github.io/xcode-man-pages/sed.1.html.
* Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in all input lines and print the result to `stdout`:
`{{command}} | sed 's/apple/mango/g'`
* Execute a specific script [f]ile and print the result to `stdout`:
`{{command}} | sed -f {{path/to/script_file.sed}}`
* Replace all `apple` (extended regex) occurrences with `APPLE` (extended regex) in all input lines and print the result to `stdout`:
`{{command}} | sed -E 's/(apple)/\U\1/g'`
* Print just a first line to `stdout`:
`{{command}} | sed -n '1p'`
* Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in a `file` and save a backup of the original to `file.bak`:
`sed -i bak 's/apple/mango/g' {{path/to/file}}` |
|
What is dash command | # dash
> Debian Almquist Shell, a modern, POSIX-compliant implementation of `sh` (not
> Bash-compatible). More information: https://manned.org/dash.
* Start an interactive shell session:
`dash`
* Execute specific [c]ommands:
`dash -c "{{echo 'dash is executed'}}"`
* Execute a specific script:
`dash {{path/to/script.sh}}`
* Check a specific script for syntax errors:
`dash -n {{path/to/script.sh}}`
* Execute a specific script while printing each command before executing it:
`dash -x {{path/to/script.sh}}`
* Execute a specific script and stop at the first [e]rror:
`dash -e {{path/to/script.sh}}`
* Execute specific commands from `stdin`:
`{{echo "echo 'dash is executed'"}} | dash` |
|
What is ex command | # ex
> Command-line text editor. See also: `vim`. More information:
> https://www.vim.org.
* Open a file:
`ex {{path/to/file}}`
* Save and Quit:
`wq<Enter>`
* Undo the last operation:
`undo<Enter>`
* Search for a pattern in the file:
`/{{search_pattern}}<Enter>`
* Perform a regular expression substitution in the whole file:
`%s/{{regular_expression}}/{{replacement}}/g<Enter>`
* Insert text:
`i<Enter>{{text}}<C-c>`
* Switch to Vim:
`visual<Enter>` |
|
What is time command | # time
> Measure how long a command took to run. Note: `time` can either exist as a
> shell builtin, a standalone program or both. More information:
> https://manned.org/time.
* Run the `command` and print the time measurements to `stdout`:
`time {{command}}` |
|
What is printf command | # printf
> Format and print text. More information:
> https://www.gnu.org/software/coreutils/printf.
* Print a text message:
`printf "{{%s\n}}" "{{Hello world}}"`
* Print an integer in bold blue:
`printf "{{\e[1;34m%.3d\e[0m\n}}" {{42}}`
* Print a float number with the Unicode Euro sign:
`printf "{{\u20AC %.2f\n}}" {{123.4}}`
* Print a text message composed with environment variables:
`printf "{{var1: %s\tvar2: %s\n}}" "{{$VAR1}}" "{{$VAR2}}"`
* Store a formatted message in a variable (does not work on zsh):
`printf -v {{myvar}} {{"This is %s = %d\n" "a year" 2016}}` |
|
What is pwd command | # pwd
> Print name of current/working directory. More information:
> https://www.gnu.org/software/coreutils/pwd.
* Print the current directory:
`pwd`
* Print the current directory, and resolve all symlinks (i.e. show the "physical" path):
`pwd -P` |
|
What is loadkeys command | # loadkeys
> Load the kernel keymap for the console. More information:
> https://manned.org/loadkeys.
* Load a default keymap:
`loadkeys --default`
* Load default keymap when an unusual keymap is loaded and `-` sign cannot be found:
`loadkeys defmap`
* Create a kernel source table:
`loadkeys --mktable`
* Create a binary keymap:
`loadkeys --bkeymap`
* Search and parse keymap without action:
`loadkeys --parse`
* Load the keymap suppressing all output:
`loadkeys --quiet`
* Load a keymap from the specified file for the console:
`loadkeys --console {{/dev/ttyN}} {{/path/to/file}}`
* Use standard names for keymaps of different locales:
`loadkeys --console {{/dev/ttyN}} {{uk}}` |
|
What is env command | # env
> Show the environment or run a program in a modified environment. More
> information: https://www.gnu.org/software/coreutils/env.
* Show the environment:
`env`
* Run a program. Often used in scripts after the shebang (#!) for looking up the path to the program:
`env {{program}}`
* Clear the environment and run a program:
`env -i {{program}}`
* Remove variable from the environment and run a program:
`env -u {{variable}} {{program}}`
* Set a variable and run a program:
`env {{variable}}={{value}} {{program}}`
* Set multiple variables and run a program:
`env {{variable1}}={{value}} {{variable2}}={{value}} {{variable3}}={{value}}
{{program}}` |
|
What is look command | # look
> Look for lines in sorted file. More information: https://manned.org/look.
* Look for lines which begins with the given prefix:
`look {{prefix}} {{path/to/file}}`
* Look for lines ignoring case:
`look --ignore-case {{prefix}} {{path/to/file}}` |
|
What is fgrep command | # fgrep
> Matches fixed strings in files. Equivalent to `grep -F`. More information:
> https://www.gnu.org/software/grep/manual/grep.html.
* Search for an exact string in a file:
`fgrep {{search_string}} {{path/to/file}}`
* Search only lines that match entirely in files:
`fgrep -x {{path/to/file1}} {{path/to/file2}}`
* Count the number of lines that match the given string in a file:
`fgrep -c {{search_string}} {{path/to/file}}`
* Show the line number in the file along with the line matched:
`fgrep -n {{search_string}} {{path/to/file}}`
* Display all lines except those that contain the search string:
`fgrep -v {{search_string}} {{path/to/file}}`
* Display filenames whose content matches the search string at least once:
`fgrep -l {{search_string}} {{path/to/file1}} {{path/to/file2}}` |
|
What is df command | # df
> Gives an overview of the filesystem disk space usage. More information:
> https://www.gnu.org/software/coreutils/df.
* Display all filesystems and their disk usage:
`df`
* Display all filesystems and their disk usage in human-readable form:
`df -h`
* Display the filesystem and its disk usage containing the given file or directory:
`df {{path/to/file_or_directory}}`
* Display statistics on the number of free inodes:
`df -i`
* Display filesystems but exclude the specified types:
`df -x {{squashfs}} -x {{tmpfs}}` |
|
What is sha512sum command | # sha512sum
> Calculate SHA512 cryptographic checksums. More information:
> https://www.gnu.org/software/coreutils/manual/html_node/sha2-utilities.html.
* Calculate the SHA512 checksum for one or more files:
`sha512sum {{path/to/file1 path/to/file2 ...}}`
* Calculate and save the list of SHA512 checksums to a file:
`sha512sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha512}}`
* Calculate a SHA512 checksum from `stdin`:
`{{command}} | sha512sum`
* Read a file of SHA512 sums and filenames and verify all files have matching checksums:
`sha512sum --check {{path/to/file.sha512}}`
* Only show a message for missing files or when verification fails:
`sha512sum --check --quiet {{path/to/file.sha512}}`
* Only show a message when verification fails, ignoring missing files:
`sha512sum --ignore-missing --check --quiet {{path/to/file.sha512}}` |
|
What is dpkg-deb command | # dpkg-deb
> Pack, unpack and provide information about Debian archives. More
> information: https://manpages.debian.org/latest/dpkg/dpkg-deb.html.
* Display information about a package:
`dpkg-deb --info {{path/to/file.deb}}`
* Display the package's name and version on one line:
`dpkg-deb --show {{path/to/file.deb}}`
* List the package's contents:
`dpkg-deb --contents {{path/to/file.deb}}`
* Extract package's contents into a directory:
`dpkg-deb --extract {{path/to/file.deb}} {{path/to/directory}}`
* Create a package from a specified directory:
`dpkg-deb --build {{path/to/directory}}` |
|
What is updatedb command | # updatedb
> Create or update the database used by `locate`. It is usually run daily by
> cron. More information: https://manned.org/updatedb.
* Refresh database content:
`sudo updatedb`
* Display file names as soon as they are found:
`sudo updatedb --verbose` |
|
What is sort command | # sort
> Sort lines of text files. More information:
> https://www.gnu.org/software/coreutils/sort.
* Sort a file in ascending order:
`sort {{path/to/file}}`
* Sort a file in descending order:
`sort --reverse {{path/to/file}}`
* Sort a file in case-insensitive way:
`sort --ignore-case {{path/to/file}}`
* Sort a file using numeric rather than alphabetic order:
`sort --numeric-sort {{path/to/file}}`
* Sort `/etc/passwd` by the 3rd field of each line numerically, using ":" as a field separator:
`sort --field-separator={{:}} --key={{3n}} {{/etc/passwd}}`
* Sort a file preserving only unique lines:
`sort --unique {{path/to/file}}`
* Sort a file, printing the output to the specified output file (can be used to sort a file in-place):
`sort --output={{path/to/file}} {{path/to/file}}`
* Sort numbers with exponents:
`sort --general-numeric-sort {{path/to/file}}` |
|
What is lex command | # lex
> Lexical analyzer generator. Given the specification for a lexical analyzer,
> generates C code implementing it. More information:
> https://keith.github.io/xcode-man-pages/lex.1.html.
* Generate an analyzer from a Lex file:
`lex {{analyzer.l}}`
* Specify the output file:
`lex {{analyzer.l}} --outfile {{analyzer.c}}`
* Compile a C file generated by Lex:
`cc {{path/to/lex.yy.c}} --output {{executable}}` |
|
What is ulimit command | # ulimit
> Get and set user limits. More information: https://manned.org/ulimit.
* Get the properties of all the user limits:
`ulimit -a`
* Get hard limit for the number of simultaneously opened files:
`ulimit -H -n`
* Get soft limit for the number of simultaneously opened files:
`ulimit -S -n`
* Set max per-user process limit:
`ulimit -u 30` |
|
What is chfn command | # chfn
> Update `finger` info for a user. More information: https://manned.org/chfn.
* Update a user's "Name" field in the output of `finger`:
`chfn -f {{new_display_name}} {{username}}`
* Update a user's "Office Room Number" field for the output of `finger`:
`chfn -o {{new_office_room_number}} {{username}}`
* Update a user's "Office Phone Number" field for the output of `finger`:
`chfn -p {{new_office_telephone_number}} {{username}}`
* Update a user's "Home Phone Number" field for the output of `finger`:
`chfn -h {{new_home_telephone_number}} {{username}}` |
|
What is nice command | # nice
> Execute a program with a custom scheduling priority (niceness). Niceness
> values range from -20 (the highest priority) to 19 (the lowest). More
> information: https://www.gnu.org/software/coreutils/nice.
* Launch a program with altered priority:
`nice -n {{niceness_value}} {{command}}` |
|
What is tail command | # tail
> Display the last part of a file. See also: `head`. More information:
> https://manned.org/man/freebsd-13.0/tail.1.
* Show last 'count' lines in file:
`tail -n {{8}} {{path/to/file}}`
* Print a file from a specific line number:
`tail -n +{{8}} {{path/to/file}}`
* Print a specific count of bytes from the end of a given file:
`tail -c {{8}} {{path/to/file}}`
* Print the last lines of a given file and keep reading file until `Ctrl + C`:
`tail -f {{path/to/file}}`
* Keep reading file until `Ctrl + C`, even if the file is inaccessible:
`tail -F {{path/to/file}}`
* Show last 'count' lines in 'file' and refresh every 'seconds' seconds:
`tail -n {{8}} -s {{10}} -f {{path/to/file}}` |
|
What is ctags command | # ctags
> Generates an index (or tag) file of language objects found in source files
> for many popular programming languages. More information: https://ctags.io/.
* Generate tags for a single file, and output them to a file named "tags" in the current directory, overwriting the file if it exists:
`ctags {{path/to/file}}`
* Generate tags for all files in the current directory, and output them to a specific file, overwriting the file if it exists:
`ctags -f {{path/to/file}} *`
* Generate tags for all files in the current directory and all subdirectories:
`ctags --recurse`
* Generate tags for a single file, and output them with start line number and end line number in JSON format:
`ctags --fields=+ne --output-format=json {{path/to/file}}` |
|
What is mkdir command | # mkdir
> Create directories and set their permissions. More information:
> https://www.gnu.org/software/coreutils/mkdir.
* Create specific directories:
`mkdir {{path/to/directory1 path/to/directory2 ...}}`
* Create specific directories and their [p]arents if needed:
`mkdir -p {{path/to/directory1 path/to/directory2 ...}}`
* Create directories with specific permissions:
`mkdir -m {{rwxrw-r--}} {{path/to/directory1 path/to/directory2 ...}}` |
|
What is test command | # test
> Check file types and compare values. Returns 0 if the condition evaluates to
> true, 1 if it evaluates to false. More information:
> https://www.gnu.org/software/coreutils/test.
* Test if a given variable is equal to a given string:
`test "{{$MY_VAR}}" == "{{/bin/zsh}}"`
* Test if a given variable is empty:
`test -z "{{$GIT_BRANCH}}"`
* Test if a file exists:
`test -f "{{path/to/file_or_directory}}"`
* Test if a directory does not exist:
`test ! -d "{{path/to/directory}}"`
* If A is true, then do B, or C in the case of an error (notice that C may run even if A fails):
`test {{condition}} && {{echo "true"}} || {{echo "false"}}` |
|
What is uptime command | # uptime
> Tell how long the system has been running and other information. More
> information: https://ss64.com/osx/uptime.html.
* Print current time, uptime, number of logged-in users and other information:
`uptime` |
|
What is sha384sum command | # sha384sum
> Calculate SHA384 cryptographic checksums. More information:
> https://www.gnu.org/software/coreutils/manual/html_node/sha2-utilities.html.
* Calculate the SHA384 checksum for one or more files:
`sha384sum {{path/to/file1 path/to/file2 ...}}`
* Calculate and save the list of SHA384 checksums to a file:
`sha384sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha384}}`
* Calculate a SHA384 checksum from `stdin`:
`{{command}} | sha384sum`
* Read a file of SHA384 sums and filenames and verify all files have matching checksums:
`sha384sum --check {{path/to/file.sha384}}`
* Only show a message for missing files or when verification fails:
`sha384sum --check --quiet {{path/to/file.sha384}}`
* Only show a message when verification fails, ignoring missing files:
`sha384sum --ignore-missing --check --quiet {{path/to/file.sha384}}` |
|
What is file command | # file
> Determine file type. More information: https://manned.org/file.
* Give a description of the type of the specified file. Works fine for files with no file extension:
`file {{path/to/file}}`
* Look inside a zipped file and determine the file type(s) inside:
`file -z {{foo.zip}}`
* Allow file to work with special or device files:
`file -s {{path/to/file}}`
* Don't stop at first file type match; keep going until the end of the file:
`file -k {{path/to/file}}`
* Determine the MIME encoding type of a file:
`file -i {{path/to/file}}` |
|
What is rm command | # rm
> Remove files or directories. See also: `rmdir`. More information:
> https://www.gnu.org/software/coreutils/rm.
* Remove specific files:
`rm {{path/to/file1 path/to/file2 ...}}`
* Remove specific files ignoring nonexistent ones:
`rm -f {{path/to/file1 path/to/file2 ...}}`
* Remove specific files [i]nteractively prompting before each removal:
`rm -i {{path/to/file1 path/to/file2 ...}}`
* Remove specific files printing info about each removal:
`rm -v {{path/to/file1 path/to/file2 ...}}`
* Remove specific files and directories [r]ecursively:
`rm -r {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}` |
|
What is git-update-ref command | # git update-ref
> Git command for creating, updating, and deleting Git refs. More information:
> https://git-scm.com/docs/git-update-ref.
* Delete a ref, useful for soft resetting the first commit:
`git update-ref -d {{HEAD}}`
* Update ref with a message:
`git update-ref -m {{message}} {{HEAD}} {{4e95e05}}` |
|
What is localectl command | # localectl
> Control the system locale and keyboard layout settings. More information:
> https://www.freedesktop.org/software/systemd/man/localectl.html.
* Show the current settings of the system locale and keyboard mapping:
`localectl`
* List available locales:
`localectl list-locales`
* Set a system locale variable:
`localectl set-locale {{LANG}}={{en_US.UTF-8}}`
* List available keymaps:
`localectl list-keymaps`
* Set the system keyboard mapping for the console and X11:
`localectl set-keymap {{us}}` |
|
What is cat command | # cat
> Print and concatenate files. More information:
> https://keith.github.io/xcode-man-pages/cat.1.html.
* Print the contents of a file to `stdout`:
`cat {{path/to/file}}`
* Concatenate several files into an output file:
`cat {{path/to/file1 path/to/file2 ...}} > {{path/to/output_file}}`
* Append several files to an output file:
`cat {{path/to/file1 path/to/file2 ...}} >> {{path/to/output_file}}`
* Copy the contents of a file into an output file without buffering:
`cat -u {{/dev/tty12}} > {{/dev/tty13}}`
* Write `stdin` to a file:
`cat - > {{path/to/file}}`
* Number all output lines:
`cat -n {{path/to/file}}`
* Display non-printable and whitespace characters (with `M-` prefix if non-ASCII):
`cat -v -t -e {{path/to/file}}` |
|
What is fc command | # fc
> Open the most recent command and edit it. More information:
> https://manned.org/fc.
* Open in the default system editor:
`fc`
* Specify an editor to open with:
`fc -e {{'emacs'}}`
* List recent commands from history:
`fc -l`
* List recent commands in reverse order:
`fc -l -r`
* List commands in a given interval:
`fc '{{416}}' '{{420}}'` |
|
What is sum command | # sum
> Compute checksums and the number of blocks for a file. A predecessor to the
> more modern `cksum`. More information:
> https://www.gnu.org/software/coreutils/sum.
* Compute a checksum with BSD-compatible algorithm and 1024-byte blocks:
`sum {{path/to/file}}`
* Compute a checksum with System V-compatible algorithm and 512-byte blocks:
`sum --sysv {{path/to/file}}` |
|
What is sha256sum command | # sha256sum
> Calculate SHA256 cryptographic checksums. More information:
> https://www.gnu.org/software/coreutils/manual/html_node/sha2-utilities.html.
* Calculate the SHA256 checksum for one or more files:
`sha256sum {{path/to/file1 path/to/file2 ...}}`
* Calculate and save the list of SHA256 checksums to a file:
`sha256sum {{path/to/file1 path/to/file2 ...}} > {{path/to/file.sha256}}`
* Calculate a SHA256 checksum from `stdin`:
`{{command}} | sha256sum`
* Read a file of SHA256 sums and filenames and verify all files have matching checksums:
`sha256sum --check {{path/to/file.sha256}}`
* Only show a message for missing files or when verification fails:
`sha256sum --check --quiet {{path/to/file.sha256}}`
* Only show a message when verification fails, ignoring missing files:
`sha256sum --ignore-missing --check --quiet {{path/to/file.sha256}}` |
|
What is runcon command | # runcon
> Run a program in a different SELinux security context. With neither context
> nor command, print the current security context. More information:
> https://www.gnu.org/software/coreutils/runcon.
* Determine the current domain:
`runcon`
* Specify the domain to run a command in:
`runcon -t {{domain}}_t {{command}}`
* Specify the context role to run a command with:
`runcon -r {{role}}_r {{command}}`
* Specify the full context to run a command with:
`runcon {{user}}_u:{{role}}_r:{{domain}}_t {{command}}` |
|
What is curl command | # curl
> Transfers data from or to a server. Supports most protocols, including HTTP,
> FTP, and POP3. More information: https://curl.se/docs/manpage.html.
* Download the contents of a URL to a file:
`curl {{http://example.com}} --output {{path/to/file}}`
* Download a file, saving the output under the filename indicated by the URL:
`curl --remote-name {{http://example.com/filename}}`
* Download a file, following location redirects, and automatically continuing (resuming) a previous file transfer and return an error on server error:
`curl --fail --remote-name --location --continue-at -
{{http://example.com/filename}}`
* Send form-encoded data (POST request of type `application/x-www-form-urlencoded`). Use `--data @file_name` or `--data @'-'` to read from STDIN:
`curl --data {{'name=bob'}} {{http://example.com/form}}`
* Send a request with an extra header, using a custom HTTP method:
`curl --header {{'X-My-Header: 123'}} --request {{PUT}}
{{http://example.com}}`
* Send data in JSON format, specifying the appropriate content-type header:
`curl --data {{'{"name":"bob"}'}} --header {{'Content-Type:
application/json'}} {{http://example.com/users/1234}}`
* Pass a username and password for server authentication:
`curl --user myusername:mypassword {{http://example.com}}`
* Pass client certificate and key for a resource, skipping certificate validation:
`curl --cert {{client.pem}} --key {{key.pem}} --insecure
{{https://example.com}}` |
|
What is git-verify-commit command | # git verify-commit
> Check for GPG verification of commits. If no commits are verified, nothing
> will be printed, regardless of options specified. More information:
> https://git-scm.com/docs/git-verify-commit.
* Check commits for a GPG signature:
`git verify-commit {{commit_hash1 optional_commit_hash2 ...}}`
* Check commits for a GPG signature and show details of each commit:
`git verify-commit {{commit_hash1 optional_commit_hash2 ...}} --verbose`
* Check commits for a GPG signature and print the raw details:
`git verify-commit {{commit_hash1 optional_commit_hash2 ...}} --raw` |
|
What is rmdir command | # rmdir
> Remove directories without files. See also: `rm`. More information:
> https://www.gnu.org/software/coreutils/rmdir.
* Remove specific directories:
`rmdir {{path/to/directory1 path/to/directory2 ...}}`
* Remove specific nested directories recursively:
`rmdir -p {{path/to/directory1 path/to/directory2 ...}}` |
|
What is getfacl command | # getfacl
> Get file access control lists. More information: https://manned.org/getfacl.
* Display the file access control list:
`getfacl {{path/to/file_or_directory}}`
* Display the file access control list with numeric user and group IDs:
`getfacl -n {{path/to/file_or_directory}}`
* Display the file access control list with tabular output format:
`getfacl -t {{path/to/file_or_directory}}` |
|
What is nsenter command | # nsenter
> Run a new command in a running process' namespace. Particularly useful for
> docker images or chroot jails. More information: https://manned.org/nsenter.
* Run a specific command using the same namespaces as an existing process:
`nsenter --target {{pid}} --all {{command}} {{command_arguments}}`
* Run a specific command in an existing process's network namespace:
`nsenter --target {{pid}} --net {{command}} {{command_arguments}}`
* Run a specific command in an existing process's PID namespace:
`nsenter --target {{pid}} --pid {{command}} {{command_arguments}}`
* Run a specific command in an existing process's IPC namespace:
`nsenter --target {{pid}} --ipc {{command}} {{command_arguments}}`
* Run a specific command in an existing process's UTS, time, and IPC namespaces:
`nsenter --target {{pid}} --uts --time --ipc -- {{command}}
{{command_arguments}}`
* Run a specific command in an existing process's namespace by referencing procfs:
`nsenter --pid=/proc/{{pid}}/pid/net -- {{command}} {{command_arguments}}` |
|
What is rsync command | # rsync
> Transfer files either to or from a remote host (but not between two remote
> hosts), by default using SSH. To specify a remote path, use
> `host:path/to/file_or_directory`. More information:
> https://download.samba.org/pub/rsync/rsync.1.
* Transfer a file:
`rsync {{path/to/source}} {{path/to/destination}}`
* Use archive mode (recursively copy directories, copy symlinks without resolving and preserve permissions, ownership and modification times):
`rsync --archive {{path/to/source}} {{path/to/destination}}`
* Compress the data as it is sent to the destination, display verbose and human-readable progress, and keep partially transferred files if interrupted:
`rsync --compress --verbose --human-readable --partial --progress
{{path/to/source}} {{path/to/destination}}`
* Recursively copy directories:
`rsync --recursive {{path/to/source}} {{path/to/destination}}`
* Transfer directory contents, but not the directory itself:
`rsync --recursive {{path/to/source}}/ {{path/to/destination}}`
* Recursively copy directories, use archive mode, resolve symlinks and skip files that are newer on the destination:
`rsync --recursive --archive --update --copy-links {{path/to/source}}
{{path/to/destination}}`
* Transfer a directory to a remote host running `rsyncd` and delete files on the destination that do not exist on the source:
`rsync --recursive --delete rsync://{{host}}:{{path/to/source}}
{{path/to/destination}}`
* Transfer a file over SSH using a different port than the default (22) and show global progress:
`rsync --rsh 'ssh -p {{port}}' --info=progress2 {{host}}:{{path/to/source}}
{{path/to/destination}}` |
|
What is unexpand command | # unexpand
> Convert spaces to tabs. More information:
> https://www.gnu.org/software/coreutils/unexpand.
* Convert blanks in each file to tabs, writing to `stdout`:
`unexpand {{path/to/file}}`
* Convert blanks to tabs, reading from `stdout`:
`unexpand`
* Convert all blanks, instead of just initial blanks:
`unexpand -a {{path/to/file}}`
* Convert only leading sequences of blanks (overrides -a):
`unexpand --first-only {{path/to/file}}`
* Have tabs a certain number of characters apart, not 8 (enables -a):
`unexpand -t {{number}} {{path/to/file}}` |
|
What is scp command | # scp
> Secure copy. Copy files between hosts using Secure Copy Protocol over SSH.
> More information: https://man.openbsd.org/scp.
* Copy a local file to a remote host:
`scp {{path/to/local_file}} {{remote_host}}:{{path/to/remote_file}}`
* Use a specific port when connecting to the remote host:
`scp -P {{port}} {{path/to/local_file}}
{{remote_host}}:{{path/to/remote_file}}`
* Copy a file from a remote host to a local directory:
`scp {{remote_host}}:{{path/to/remote_file}} {{path/to/local_directory}}`
* Recursively copy the contents of a directory from a remote host to a local directory:
`scp -r {{remote_host}}:{{path/to/remote_directory}}
{{path/to/local_directory}}`
* Copy a file between two remote hosts transferring through the local host:
`scp -3 {{host1}}:{{path/to/remote_file}}
{{host2}}:{{path/to/remote_directory}}`
* Use a specific username when connecting to the remote host:
`scp {{path/to/local_file}}
{{remote_username}}@{{remote_host}}:{{path/to/remote_directory}}`
* Use a specific ssh private key for authentication with the remote host:
`scp -i {{~/.ssh/private_key}} {{local_file}}
{{remote_host}}:{{/path/remote_file}}` |
|
What is timedatectl command | # timedatectl
> Control the system time and date. More information:
> https://manned.org/timedatectl.
* Check the current system clock time:
`timedatectl`
* Set the local time of the system clock directly:
`timedatectl set-time "{{yyyy-MM-dd hh:mm:ss}}"`
* List available timezones:
`timedatectl list-timezones`
* Set the system timezone:
`timedatectl set-timezone {{timezone}}`
* Enable Network Time Protocol (NTP) synchronization:
`timedatectl set-ntp on`
* Change the hardware clock time standard to localtime:
`timedatectl set-local-rtc 1` |
|
What is screen command | # screen
> Hold a session open on a remote server. Manage multiple windows with a
> single SSH connection. See also `tmux` and `zellij`. More information:
> https://manned.org/screen.
* Start a new screen session:
`screen`
* Start a new named screen session:
`screen -S {{session_name}}`
* Start a new daemon and log the output to `screenlog.x`:
`screen -dmLS {{session_name}} {{command}}`
* Show open screen sessions:
`screen -ls`
* Reattach to an open screen:
`screen -r {{session_name}}`
* Detach from inside a screen:
`Ctrl + A, D`
* Kill the current screen session:
`Ctrl + A, K`
* Kill a detached screen:
`screen -X -S {{session_name}} quit` |
|
What is write command | # write
> Write a message on the terminal of a specified logged in user (ctrl-C to
> stop writing messages). Use the `who` command to find out all terminal_ids
> of all active users active on the system. See also `mesg`. More information:
> https://manned.org/write.
* Send a message to a given user on a given terminal id:
`write {{username}} {{terminal_id}}`
* Send message to "testuser" on terminal `/dev/tty/5`:
`write {{testuser}} {{tty/5}}`
* Send message to "johndoe" on pseudo terminal `/dev/pts/5`:
`write {{johndoe}} {{pts/5}}` |
|
What is as command | # as
> Portable GNU assembler. Primarily intended to assemble output from `gcc` to
> be used by `ld`. More information: https://www.unix.com/man-page/osx/1/as/.
* Assemble a file, writing the output to `a.out`:
`as {{path/to/file.s}}`
* Assemble the output to a given file:
`as {{path/to/file.s}} -o {{path/to/output_file.o}}`
* Generate output faster by skipping whitespace and comment preprocessing. (Should only be used for trusted compilers):
`as -f {{path/to/file.s}}`
* Include a given path to the list of directories to search for files specified in `.include` directives:
`as -I {{path/to/directory}} {{path/to/file.s}}` |
|
What is systemd-cat command | # systemd-cat
> Connect a pipeline or program's output streams with the systemd journal.
> More information: https://www.freedesktop.org/software/systemd/man/systemd-
> cat.html.
* Write the output of the specified command to the journal (both output streams are captured):
`systemd-cat {{command}}`
* Write the output of a pipeline to the journal (`stderr` stays connected to the terminal):
`{{command}} | systemd-cat` |
|
What is git-rev-parse command | # git rev-parse
> Display metadata related to specific revisions. More information:
> https://git-scm.com/docs/git-rev-parse.
* Get the commit hash of a branch:
`git rev-parse {{branch_name}}`
* Get the current branch name:
`git rev-parse --abbrev-ref {{HEAD}}`
* Get the absolute path to the root directory:
`git rev-parse --show-toplevel` |
|
What is patch command | # patch
> Patch a file (or files) with a diff file. Note that diff files should be
> generated by the `diff` command. More information: https://manned.org/patch.
* Apply a patch using a diff file (filenames must be included in the diff file):
`patch < {{patch.diff}}`
* Apply a patch to a specific file:
`patch {{path/to/file}} < {{patch.diff}}`
* Patch a file writing the result to a different file:
`patch {{path/to/input_file}} -o {{path/to/output_file}} < {{patch.diff}}`
* Apply a patch to the current directory:
`patch -p1 < {{patch.diff}}`
* Apply the reverse of a patch:
`patch -R < {{patch.diff}}` |
|
What is size command | # size
> Displays the sizes of sections inside binary files. More information:
> https://sourceware.org/binutils/docs/binutils/size.html.
* Display the size of sections in a given object or executable file:
`size {{path/to/file}}`
* Display the size of sections in a given object or executable file in [o]ctal:
`size {{-o|--radix=8}} {{path/to/file}}`
* Display the size of sections in a given object or executable file in [d]ecimal:
`size {{-d|--radix=10}} {{path/to/file}}`
* Display the size of sections in a given object or executable file in he[x]adecimal:
`size {{-x|--radix=16}} {{path/to/file}}` |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.