axs2k/anubis
Updated
•
1
system
stringclasses 1
value | command
stringlengths 1
20
| response
stringlengths 101
1.77k
|
---|---|---|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | w | # w
> Show who is logged on and what they are doing. Print user login, TTY, remote
> host, login time, idle time, current process. More information:
> https://ss64.com/osx/w.html.
* Show logged-in users information:
`w`
* Show logged-in users information without a header:
`w -h`
* Show information about logged-in users, sorted by their idle time:
`w -i` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ar | # 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 ...}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | mv | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ps | # 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` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ld | # 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` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | rm | # 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 ...}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | mv | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | fc | # 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}}'` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | wc | # wc
> Count lines, words, or bytes. More information:
> https://ss64.com/osx/wc.html.
* Count lines in file:
`wc -l {{path/to/file}}`
* Count words in file:
`wc -w {{path/to/file}}`
* Count characters (bytes) in file:
`wc -c {{path/to/file}}`
* Count characters in file (taking multi-byte character sets into account):
`wc -m {{path/to/file}}`
* Use `stdin` to count lines, words and characters (bytes) in that order:
`{{find .}} | wc` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | id | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | dd | # dd
> Convert and copy a file. More information: https://keith.github.io/xcode-
> man-pages/dd.1.html.
* Make a bootable USB drive from an isohybrid file (such like `archlinux-xxx.iso`) and show the progress:
`dd if={{path/to/file.iso}} of={{/dev/usb_device}} status=progress`
* Clone a drive to another drive with 4 MB block, ignore error and show the progress:
`dd if={{/dev/source_device}} of={{/dev/dest_device}} bs={{4m}}
conv={{noerror}} status=progress`
* Generate a file of 100 random bytes by using kernel random driver:
`dd if=/dev/urandom of={{path/to/random_file}} bs={{100}} count={{1}}`
* Benchmark the write performance of a disk:
`dd if=/dev/zero of={{path/to/1GB_file}} bs={{1024}} count={{1000000}}`
* Generate a system backup into an IMG file and show the progress:
`dd if=/dev/{{drive_device}} of={{path/to/file.img}} status=progress`
* Restore a drive from an IMG file and show the progress:
`dd if={{path/to/file.img}} of={{/dev/drive_device}} status=progress`
* Check the progress of an ongoing dd operation (run this command from another shell):
`kill -USR1 $(pgrep ^dd)` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | df | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | nl | # nl
> A utility for numbering lines, either from a file, or from `stdin`. More
> information: https://www.gnu.org/software/coreutils/nl.
* Number non-blank lines in a file:
`nl {{path/to/file}}`
* Read from `stdout`:
`cat {{path/to/file}} | nl {{options}} -`
* Number only the lines with printable text:
`nl -t {{path/to/file}}`
* Number all lines including blank lines:
`nl -b a {{path/to/file}}`
* Number only the body lines that match a basic regular expression (BRE) pattern:
`nl -b p'FooBar[0-9]' {{path/to/file}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | bg | # bg
> Resumes jobs that have been suspended (e.g. using `Ctrl + Z`), and keeps
> them running in the background. More information: https://manned.org/bg.
* Resume the most recently suspended job and run it in the background:
`bg`
* Resume a specific job (use `jobs -l` to get its ID) and run it in the background:
`bg %{{job_id}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ex | # 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>` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | id | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | as | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ln | # ln
> Creates links to files and directories. More information:
> https://www.gnu.org/software/coreutils/ln.
* Create a symbolic link to a file or directory:
`ln -s {{/path/to/file_or_directory}} {{path/to/symlink}}`
* Overwrite an existing symbolic link to point to a different file:
`ln -sf {{/path/to/new_file}} {{path/to/symlink}}`
* Create a hard link to a file:
`ln {{/path/to/file}} {{path/to/hardlink}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | du | # du
> Disk usage: estimate and summarize file and directory space usage. More
> information: https://ss64.com/osx/du.html.
* List the sizes of a directory and any subdirectories, in the given unit (KiB/MiB/GiB):
`du -{{k|m|g}} {{path/to/directory}}`
* List the sizes of a directory and any subdirectories, in human-readable form (i.e. auto-selecting the appropriate unit for each size):
`du -h {{path/to/directory}}`
* Show the size of a single directory, in human-readable units:
`du -sh {{path/to/directory}}`
* List the human-readable sizes of a directory and of all the files and directories within it:
`du -ah {{path/to/directory}}`
* List the human-readable sizes of a directory and any subdirectories, up to N levels deep:
`du -h -d {{2}} {{path/to/directory}}`
* List the human-readable size of all `.jpg` files in subdirectories of the current directory, and show a cumulative total at the end:
`du -ch {{*/*.jpg}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | nm | # nm
> List symbol names in object files. More information: https://manned.org/nm.
* List global (extern) functions in a file (prefixed with T):
`nm -g {{path/to/file.o}}`
* List only undefined symbols in a file:
`nm -u {{path/to/file.o}}`
* List all symbols, even debugging symbols:
`nm -a {{path/to/file.o}}`
* Demangle C++ symbols (make them readable):
`nm --demangle {{path/to/file.o}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | vi | # vi
> This command is an alias of `vim`.
* View documentation for the original command:
`tldr vim` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | rm | # 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 ...}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | lp | # lp
> Print files. More information: https://manned.org/lp.
* Print the output of a command to the default printer (see `lpstat` command):
`echo "test" | lp`
* Print a file to the default printer:
`lp {{path/to/filename}}`
* Print a file to a named printer (see `lpstat` command):
`lp -d {{printer_name}} {{path/to/filename}}`
* Print N copies of file to default printer (replace N with desired number of copies):
`lp -n {{N}} {{path/to/filename}}`
* Print only certain pages to the default printer (print pages 1, 3-5, and 16):
`lp -P 1,3-5,16 {{path/to/filename}}`
* Resume printing a job:
`lp -i {{job_id}} -H resume` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | dd | # dd
> Convert and copy a file. More information: https://keith.github.io/xcode-
> man-pages/dd.1.html.
* Make a bootable USB drive from an isohybrid file (such like `archlinux-xxx.iso`) and show the progress:
`dd if={{path/to/file.iso}} of={{/dev/usb_device}} status=progress`
* Clone a drive to another drive with 4 MB block, ignore error and show the progress:
`dd if={{/dev/source_device}} of={{/dev/dest_device}} bs={{4m}}
conv={{noerror}} status=progress`
* Generate a file of 100 random bytes by using kernel random driver:
`dd if=/dev/urandom of={{path/to/random_file}} bs={{100}} count={{1}}`
* Benchmark the write performance of a disk:
`dd if=/dev/zero of={{path/to/1GB_file}} bs={{1024}} count={{1000000}}`
* Generate a system backup into an IMG file and show the progress:
`dd if=/dev/{{drive_device}} of={{path/to/file.img}} status=progress`
* Restore a drive from an IMG file and show the progress:
`dd if={{path/to/file.img}} of={{/dev/drive_device}} status=progress`
* Check the progress of an ongoing dd operation (run this command from another shell):
`kill -USR1 $(pgrep ^dd)` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | nm | # nm
> List symbol names in object files. More information: https://manned.org/nm.
* List global (extern) functions in a file (prefixed with T):
`nm -g {{path/to/file.o}}`
* List only undefined symbols in a file:
`nm -u {{path/to/file.o}}`
* List all symbols, even debugging symbols:
`nm -a {{path/to/file.o}}`
* Demangle C++ symbols (make them readable):
`nm --demangle {{path/to/file.o}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ln | # ln
> Creates links to files and directories. More information:
> https://www.gnu.org/software/coreutils/ln.
* Create a symbolic link to a file or directory:
`ln -s {{/path/to/file_or_directory}} {{path/to/symlink}}`
* Overwrite an existing symbolic link to point to a different file:
`ln -sf {{/path/to/new_file}} {{path/to/symlink}}`
* Create a hard link to a file:
`ln {{/path/to/file}} {{path/to/hardlink}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | pr | # pr
> Paginate or columnate files for printing. More information:
> https://www.gnu.org/software/coreutils/pr.
* Print multiple files with a default header and footer:
`pr {{file1}} {{file2}} {{file3}}`
* Print with a custom centered header:
`pr -h "{{header}}" {{file1}} {{file2}} {{file3}}`
* Print with numbered lines and a custom date format:
`pr -n -D "{{format}}" {{file1}} {{file2}} {{file3}}`
* Print all files together, one in each column, without a header or footer:
`pr -m -T {{file1}} {{file2}} {{file3}}`
* Print, beginning at page 2 up to page 5, with a given page length (including header and footer):
`pr +{{2}}:{{5}} -l {{page_length}} {{file1}} {{file2}} {{file3}}`
* Print with an offset for each line and a truncating custom page width:
`pr -o {{offset}} -W {{width}} {{file1}} {{file2}} {{file3}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ed | # ed
> The original Unix text editor. See also: `awk`, `sed`. More information:
> https://www.gnu.org/software/ed/manual/ed_manual.html.
* Start an interactive editor session with an empty document:
`ed`
* Start an interactive editor session with an empty document and a specific [p]rompt:
`ed -p '> '`
* Start an interactive editor session with an empty document and without diagnostics, byte counts and '!' prompt:
`ed -s`
* Edit a specific file (this shows the byte count of the loaded file):
`ed {{path/to/file}}`
* Replace a string with a specific replacement for all lines:
`,s/{{regular_expression}}/{{replacement}}/g` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | tr | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | m4 | # m4
> Macro processor. More information: https://www.gnu.org/software/m4.
* Process macros in a file:
`m4 {{path/to/file}}`
* Define a macro before processing files:
`m4 -D{{macro_name}}={{macro_value}} {{path/to/file}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ul | # ul
> Performs the underlining of a text. Each character in a given string must be
> underlined separately. More information: https://manned.org/ul.
* Display the contents of the file with underlines where applicable:
`ul {{file.txt}}`
* Display the contents of the file with underlines made of dashes `-`:
`ul -i {{file.txt}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | nl | # nl
> A utility for numbering lines, either from a file, or from `stdin`. More
> information: https://www.gnu.org/software/coreutils/nl.
* Number non-blank lines in a file:
`nl {{path/to/file}}`
* Read from `stdout`:
`cat {{path/to/file}} | nl {{options}} -`
* Number only the lines with printable text:
`nl -t {{path/to/file}}`
* Number all lines including blank lines:
`nl -b a {{path/to/file}}`
* Number only the body lines that match a basic regular expression (BRE) pattern:
`nl -b p'FooBar[0-9]' {{path/to/file}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | sh | # sh
> Bourne shell, the standard command language interpreter. See also
> `histexpand` for history expansion. More information: https://manned.org/sh.
* Start an interactive shell session:
`sh`
* Execute a command and then exit:
`sh -c "{{command}}"`
* Execute a script:
`sh {{path/to/script.sh}}`
* Read and execute commands from `stdin`:
`sh -s` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ls | # ls
> List directory contents. More information:
> https://www.gnu.org/software/coreutils/ls.
* List files one per line:
`ls -1`
* List all files, including hidden files:
`ls -a`
* List all files, with trailing `/` added to directory names:
`ls -F`
* Long format list (permissions, ownership, size, and modification date) of all files:
`ls -la`
* Long format list with size displayed using human-readable units (KiB, MiB, GiB):
`ls -lh`
* Long format list sorted by size (descending):
`ls -lS`
* Long format list of all files, sorted by modification date (oldest first):
`ls -ltr`
* Only list directories:
`ls -d */` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | pr | # pr
> Paginate or columnate files for printing. More information:
> https://www.gnu.org/software/coreutils/pr.
* Print multiple files with a default header and footer:
`pr {{file1}} {{file2}} {{file3}}`
* Print with a custom centered header:
`pr -h "{{header}}" {{file1}} {{file2}} {{file3}}`
* Print with numbered lines and a custom date format:
`pr -n -D "{{format}}" {{file1}} {{file2}} {{file3}}`
* Print all files together, one in each column, without a header or footer:
`pr -m -T {{file1}} {{file2}} {{file3}}`
* Print, beginning at page 2 up to page 5, with a given page length (including header and footer):
`pr +{{2}}:{{5}} -l {{page_length}} {{file1}} {{file2}} {{file3}}`
* Print with an offset for each line and a truncating custom page width:
`pr -o {{offset}} -W {{width}} {{file1}} {{file2}} {{file3}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | cp | # 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 ...}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | tr | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | df | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | cd | # cd
> Change the current working directory. More information:
> https://manned.org/cd.
* Go to the specified directory:
`cd {{path/to/directory}}`
* Go up to the parent of the current directory:
`cd ..`
* Go to the home directory of the current user:
`cd`
* Go to the home directory of the specified user:
`cd ~{{username}}`
* Go to the previously chosen directory:
`cd -`
* Go to the root directory:
`cd /` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | su | # 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}}"` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | pv | # pv
> Monitor the progress of data through a pipe. More information:
> https://manned.org/pv.
* Print the contents of the file and display a progress bar:
`pv {{path/to/file}}`
* Measure the speed and amount of data flow between pipes (`--size` is optional):
`command1 | pv --size {{expected_amount_of_data_for_eta}} | command2`
* Filter a file, see both progress and amount of output data:
`pv -cN in {{big_text_file}} | grep {{pattern}} | pv -cN out >
{{filtered_file}}`
* Attach to an already running process and see its file reading progress:
`pv -d {{PID}}`
* Read an erroneous file, skip errors as `dd conv=sync,noerror` would:
`pv -EE {{path/to/faulty_media}} > image.img`
* Stop reading after reading specified amount of data, rate limit to 1K/s:
`pv -L 1K --stop-at --size {{maximum_file_size_to_be_read}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | lp | # lp
> Print files. More information: https://manned.org/lp.
* Print the output of a command to the default printer (see `lpstat` command):
`echo "test" | lp`
* Print a file to the default printer:
`lp {{path/to/filename}}`
* Print a file to a named printer (see `lpstat` command):
`lp -d {{printer_name}} {{path/to/filename}}`
* Print N copies of file to default printer (replace N with desired number of copies):
`lp -n {{N}} {{path/to/filename}}`
* Print only certain pages to the default printer (print pages 1, 3-5, and 16):
`lp -P 1,3-5,16 {{path/to/filename}}`
* Resume printing a job:
`lp -i {{job_id}} -H resume` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ps | # 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` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ac | # ac
> Print statistics on how long users have been connected. More information:
> https://man.openbsd.org/ac.
* Print how long the current user has been connected in hours:
`ac`
* Print how long users have been connected in hours:
`ac -p`
* Print how long a particular user has been connected in hours:
`ac -p {{username}}`
* Print how long a particular user has been connected in hours per day (with total):
`ac -dp {{username}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | od | # od
> Display file contents in octal, decimal or hexadecimal format. Optionally
> display the byte offsets and/or printable representation for each line. More
> information: https://www.gnu.org/software/coreutils/od.
* Display file using default settings: octal format, 8 bytes per line, byte offsets in octal, and duplicate lines replaced with `*`:
`od {{path/to/file}}`
* Display file in verbose mode, i.e. without replacing duplicate lines with `*`:
`od -v {{path/to/file}}`
* Display file in hexadecimal format (2-byte units), with byte offsets in decimal format:
`od --format={{x}} --address-radix={{d}} -v {{path/to/file}}`
* Display file in hexadecimal format (1-byte units), and 4 bytes per line:
`od --format={{x1}} --width={{4}} -v {{path/to/file}}`
* Display file in hexadecimal format along with its character representation, and do not print byte offsets:
`od --format={{xz}} --address-radix={{n}} -v {{path/to/file}}`
* Read only 100 bytes of a file starting from the 500th byte:
`od --read-bytes {{100}} --skip-bytes={{500}} -v {{path/to/file}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ar | # 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 ...}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | su | # 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}}"` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | od | # od
> Display file contents in octal, decimal or hexadecimal format. Optionally
> display the byte offsets and/or printable representation for each line. More
> information: https://www.gnu.org/software/coreutils/od.
* Display file using default settings: octal format, 8 bytes per line, byte offsets in octal, and duplicate lines replaced with `*`:
`od {{path/to/file}}`
* Display file in verbose mode, i.e. without replacing duplicate lines with `*`:
`od -v {{path/to/file}}`
* Display file in hexadecimal format (2-byte units), with byte offsets in decimal format:
`od --format={{x}} --address-radix={{d}} -v {{path/to/file}}`
* Display file in hexadecimal format (1-byte units), and 4 bytes per line:
`od --format={{x1}} --width={{4}} -v {{path/to/file}}`
* Display file in hexadecimal format along with its character representation, and do not print byte offsets:
`od --format={{xz}} --address-radix={{n}} -v {{path/to/file}}`
* Read only 100 bytes of a file starting from the 500th byte:
`od --read-bytes {{100}} --skip-bytes={{500}} -v {{path/to/file}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ls | # ls
> List directory contents. More information:
> https://www.gnu.org/software/coreutils/ls.
* List files one per line:
`ls -1`
* List all files, including hidden files:
`ls -a`
* List all files, with trailing `/` added to directory names:
`ls -F`
* Long format list (permissions, ownership, size, and modification date) of all files:
`ls -la`
* Long format list with size displayed using human-readable units (KiB, MiB, GiB):
`ls -lh`
* Long format list sorted by size (descending):
`ls -lS`
* Long format list of all files, sorted by modification date (oldest first):
`ls -ltr`
* Only list directories:
`ls -d */` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | bc | # bc
> An arbitrary precision calculator language. See also: `dc`. More
> information: https://manned.org/man/freebsd-13.0/bc.1.
* Start an interactive session:
`bc`
* Start an interactive session with the standard math library enabled:
`bc --mathlib`
* Calculate an expression:
`bc --expression='{{5 / 3}}'`
* Execute a script:
`bc {{path/to/script.bc}}`
* Calculate an expression with the specified scale:
`bc --expression='scale = {{10}}; {{5 / 3}}'`
* Calculate a sine/cosine/arctangent/natural logarithm/exponential function using `mathlib`:
`bc --mathlib --expression='{{s|c|a|l|e}}({{1}})'` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | fg | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | du | # du
> Disk usage: estimate and summarize file and directory space usage. More
> information: https://ss64.com/osx/du.html.
* List the sizes of a directory and any subdirectories, in the given unit (KiB/MiB/GiB):
`du -{{k|m|g}} {{path/to/directory}}`
* List the sizes of a directory and any subdirectories, in human-readable form (i.e. auto-selecting the appropriate unit for each size):
`du -h {{path/to/directory}}`
* Show the size of a single directory, in human-readable units:
`du -sh {{path/to/directory}}`
* List the human-readable sizes of a directory and of all the files and directories within it:
`du -ah {{path/to/directory}}`
* List the human-readable sizes of a directory and any subdirectories, up to N levels deep:
`du -h -d {{2}} {{path/to/directory}}`
* List the human-readable size of all `.jpg` files in subdirectories of the current directory, and show a cumulative total at the end:
`du -ch {{*/*.jpg}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | cp | # 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 ...}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | who | # who
> Display who is logged in and related data (processes, boot time). More
> information: https://www.gnu.org/software/coreutils/who.
* Display the username, line, and time of all currently logged-in sessions:
`who`
* Display information only for the current terminal session:
`who am i`
* Display all available information:
`who -a`
* Display all available information with table headers:
`who -a -H` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | pax | # pax
> Archiving and copying utility. More information: https://manned.org/pax.1p.
* List the contents of an archive:
`pax -f {{archive.tar}}`
* List the contents of a gzipped archive:
`pax -zf {{archive.tar.gz}}`
* Create an archive from files:
`pax -wf {{target.tar}} {{path/to/file1}} {{path/to/file2}} {{path/to/file3}}`
* Create an archive from files, using output redirection:
`pax -w {{path/to/file1}} {{path/to/file2}} {{path/to/file3}} >
{{target.tar}}`
* Extract an archive into the current directory:
`pax -rf {{source.tar}}`
* Copy to a directory, while keeping the original metadata; `target/` must exist:
`pax -rw {{path/to/file1}} {{path/to/directory1}} {{path/to/directory2}}
{{target/}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | scp | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ssh | # ssh
> Secure Shell is a protocol used to securely log onto remote systems. It can
> be used for logging or executing commands on a remote server. More
> information: https://man.openbsd.org/ssh.
* Connect to a remote server:
`ssh {{username}}@{{remote_host}}`
* Connect to a remote server with a specific identity (private key):
`ssh -i {{path/to/key_file}} {{username}}@{{remote_host}}`
* Connect to a remote server using a specific port:
`ssh {{username}}@{{remote_host}} -p {{2222}}`
* Run a command on a remote server with a [t]ty allocation allowing interaction with the remote command:
`ssh {{username}}@{{remote_host}} -t {{command}} {{command_arguments}}`
* SSH tunneling: Dynamic port forwarding (SOCKS proxy on `localhost:1080`):
`ssh -D {{1080}} {{username}}@{{remote_host}}`
* SSH tunneling: Forward a specific port (`localhost:9999` to `example.org:80`) along with disabling pseudo-[T]ty allocation and executio[N] of remote commands:
`ssh -L {{9999}}:{{example.org}}:{{80}} -N -T {{username}}@{{remote_host}}`
* SSH jumping: Connect through a jumphost to a remote server (Multiple jump hops may be specified separated by comma characters):
`ssh -J {{username}}@{{jump_host}} {{username}}@{{remote_host}}`
* Agent forwarding: Forward the authentication information to the remote machine (see `man ssh_config` for available options):
`ssh -A {{username}}@{{remote_host}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | set | # set
> Display, set or unset values of shell attributes and positional parameters.
> More information: https://manned.org/set.
* Display the names and values of shell variables:
`set`
* Mark variables that are modified or created for export:
`set -a`
* Notify of job termination immediately:
`set -b`
* Set various options, e.g. enable `vi` style line editing:
`set -o {{vi}}`
* Set the shell to exit as soon as the first error is encountered (mostly used in scripts):
`set -e` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | cut | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | pwd | # 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` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | man | # 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}}"` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | tty | # tty
> Returns terminal name. More information:
> https://www.gnu.org/software/coreutils/tty.
* Print the file name of this terminal:
`tty` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | tar | # tar
> Archiving utility. Often combined with a compression method, such as gzip or
> bzip2. More information: https://www.gnu.org/software/tar.
* [c]reate an archive and write it to a [f]ile:
`tar cf {{path/to/target.tar}} {{path/to/file1 path/to/file2 ...}}`
* [c]reate a g[z]ipped archive and write it to a [f]ile:
`tar czf {{path/to/target.tar.gz}} {{path/to/file1 path/to/file2 ...}}`
* [c]reate a g[z]ipped archive from a directory using relative paths:
`tar czf {{path/to/target.tar.gz}} --directory={{path/to/directory}} .`
* E[x]tract a (compressed) archive [f]ile into the current directory [v]erbosely:
`tar xvf {{path/to/source.tar[.gz|.bz2|.xz]}}`
* E[x]tract a (compressed) archive [f]ile into the target directory:
`tar xf {{path/to/source.tar[.gz|.bz2|.xz]}}
--directory={{path/to/directory}}`
* [c]reate a compressed archive and write it to a [f]ile, using [a]rchive suffix to determine the compression program:
`tar caf {{path/to/target.tar.xz}} {{path/to/file1 path/to/file2 ...}}`
* Lis[t] the contents of a tar [f]ile [v]erbosely:
`tar tvf {{path/to/source.tar}}`
* E[x]tract files matching a pattern from an archive [f]ile:
`tar xf {{path/to/source.tar}} --wildcards "{{*.html}}"` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | tac | # 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 ...}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | rev | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | cal | # cal
> Prints calendar information. More information:
> https://ss64.com/osx/cal.html.
* Display a calendar for the current month:
`cal`
* Display previous, current and next month:
`cal -3`
* Display a calendar for a specific month (1-12 or name):
`cal -m {{month}}`
* Display a calendar for the current year:
`cal -y`
* Display a calendar for a specific year (4 digits):
`cal {{year}}`
* Display a calendar for a specific month and year:
`cal {{month}} {{year}}`
* Display date of Easter (Western Christian churches) in a given year:
`ncal -e {{year}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | gdb | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | tee | # tee
> Read from `stdin` and write to `stdout` and files (or commands). More
> information: https://www.gnu.org/software/coreutils/tee.
* Copy `stdin` to each file, and also to `stdout`:
`echo "example" | tee {{path/to/file}}`
* Append to the given files, do not overwrite:
`echo "example" | tee -a {{path/to/file}}`
* Print `stdin` to the terminal, and also pipe it into another program for further processing:
`echo "example" | tee {{/dev/tty}} | {{xargs printf "[%s]"}}`
* Create a directory called "example", count the number of characters in "example" and write "example" to the terminal:
`echo "example" | tee >(xargs mkdir) >(wc -c)` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | tbl | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | pwd | # 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` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | sed | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | gcc | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | lpr | # lpr
> CUPS tool for printing files. See also: `lpstat` and `lpadmin`. More
> information: https://www.cups.org/doc/man-lpr.html.
* Print a file to the default printer:
`lpr {{path/to/file}}`
* Print 2 copies:
`lpr -# {{2}} {{path/to/file}}`
* Print to a named printer:
`lpr -P {{printer}} {{path/to/file}}`
* Print either a single page (e.g. 2) or a range of pages (e.g. 2–16):
`lpr -o page-ranges={{2|2-16}} {{path/to/file}}`
* Print double-sided either in portrait (long) or in landscape (short):
`lpr -o sides={{two-sided-long-edge|two-sided-short-edge}} {{path/to/file}}`
* Set page size (more options may be available depending on setup):
`lpr -o media={{a4|letter|legal}} {{path/to/file}}`
* Print multiple pages per sheet:
`lpr -o number-up={{2|4|6|9|16}} {{path/to/file}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | sed | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | cut | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | fmt | # fmt
> Reformat a text file by joining its paragraphs and limiting the line width
> to given number of characters (75 by default). More information:
> https://www.gnu.org/software/coreutils/fmt.
* Reformat a file:
`fmt {{path/to/file}}`
* Reformat a file producing output lines of (at most) `n` characters:
`fmt -w {{n}} {{path/to/file}}`
* Reformat a file without joining lines shorter than the given width together:
`fmt -s {{path/to/file}}`
* Reformat a file with uniform spacing (1 space between words and 2 spaces between paragraphs):
`fmt -u {{path/to/file}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | top | # top
> Display dynamic real-time information about running processes. More
> information: https://ss64.com/osx/top.html.
* Start `top`, all options are available in the interface:
`top`
* Start `top` sorting processes by internal memory size (default order - process ID):
`top -o mem`
* Start `top` sorting processes first by CPU, then by running time:
`top -o cpu -O time`
* Start `top` displaying only processes owned by given user:
`top -user {{user_name}}`
* Get help about interactive commands:
`?` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | ldd | # ldd
> Display shared library dependencies of a binary. Do not use on an untrusted
> binary, use objdump for that instead. More information:
> https://manned.org/ldd.
* Display shared library dependencies of a binary:
`ldd {{path/to/binary}}`
* Display all information about dependencies:
`ldd --verbose {{path/to/binary}}`
* Display unused direct dependencies:
`ldd --unused {{path/to/binary}}`
* Report missing data objects and perform data relocations:
`ldd --data-relocs {{path/to/binary}}`
* Report missing data objects and functions, and perform relocations for both:
`ldd --function-relocs {{path/to/binary}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | yes | # yes
> Output something repeatedly. This command is commonly used to answer yes to
> every prompt by install commands (such as apt-get). More information:
> https://www.gnu.org/software/coreutils/yes.
* Repeatedly output "message":
`yes {{message}}`
* Repeatedly output "y":
`yes`
* Accept everything prompted by the `apt-get` command:
`yes | sudo apt-get install {{program}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | man | # 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}}"` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | seq | # seq
> Output a sequence of numbers to `stdout`. More information:
> https://www.gnu.org/software/coreutils/seq.
* Sequence from 1 to 10:
`seq 10`
* Every 3rd number from 5 to 20:
`seq 5 3 20`
* Separate the output with a space instead of a newline:
`seq -s " " 5 3 20`
* Format output width to a minimum of 4 digits padding with zeros as necessary:
`seq -f "%04g" 5 3 20` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | cmp | # cmp
> Compare two files byte by byte. More information:
> https://www.gnu.org/software/diffutils/manual/html_node/Invoking-cmp.html.
* Output char and line number of the first difference between two files:
`cmp {{path/to/file1}} {{path/to/file2}}`
* Output info of the first difference: char, line number, bytes, and values:
`cmp --print-bytes {{path/to/file1}} {{path/to/file2}}`
* Output the byte numbers and values of every difference:
`cmp --verbose {{path/to/file1}} {{path/to/file2}}`
* Compare files but output nothing, yield only the exit status:
`cmp --quiet {{path/to/file1}} {{path/to/file2}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | sum | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | c99 | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | cat | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | cmp | # cmp
> Compare two files byte by byte. More information:
> https://www.gnu.org/software/diffutils/manual/html_node/Invoking-cmp.html.
* Output char and line number of the first difference between two files:
`cmp {{path/to/file1}} {{path/to/file2}}`
* Output info of the first difference: char, line number, bytes, and values:
`cmp --print-bytes {{path/to/file1}} {{path/to/file2}}`
* Output the byte numbers and values of every difference:
`cmp --verbose {{path/to/file1}} {{path/to/file2}}`
* Compare files but output nothing, yield only the exit status:
`cmp --quiet {{path/to/file1}} {{path/to/file2}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | git | # git
> Distributed version control system. Some subcommands such as `commit`,
> `add`, `branch`, `checkout`, `push`, etc. have their own usage
> documentation, accessible via `tldr git subcommand`. More information:
> https://git-scm.com/.
* Check the Git version:
`git --version`
* Show general help:
`git --help`
* Show help on a Git subcommand (like `clone`, `add`, `push`, `log`, etc.):
`git help {{subcommand}}`
* Execute a Git subcommand:
`git {{subcommand}}`
* Execute a Git subcommand on a custom repository root path:
`git -C {{path/to/repo}} {{subcommand}}`
* Execute a Git subcommand with a given configuration set:
`git -c '{{config.key}}={{value}}' {{subcommand}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | awk | # awk
> A versatile programming language for working on files. More information:
> https://github.com/onetrueawk/awk.
* Print the fifth column (a.k.a. field) in a space-separated file:
`awk '{print $5}' {{path/to/file}}`
* Print the second column of the lines containing "foo" in a space-separated file:
`awk '/{{foo}}/ {print $2}' {{path/to/file}}`
* Print the last column of each line in a file, using a comma (instead of space) as a field separator:
`awk -F ',' '{print $NF}' {{path/to/file}}`
* Sum the values in the first column of a file and print the total:
`awk '{s+=$1} END {print s}' {{path/to/file}}`
* Print every third line starting from the first line:
`awk 'NR%3==1' {{path/to/file}}`
* Print different values based on conditions:
`awk '{if ($1 == "foo") print "Exact match foo"; else if ($1 ~ "bar") print
"Partial match bar"; else print "Baz"}' {{path/to/file}}`
* Print all lines where the 10th column value equals the specified value:
`awk '($10 == value)'`
* Print all the lines which the 10th column value is between a min and a max:
`awk '($10 >= min_value && $10 <= max_value)'` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | sar | # sar
> Monitor performance of various Linux subsystems. More information:
> https://manned.org/sar.
* Report I/O and transfer rate issued to physical devices, one per second (press CTRL+C to quit):
`sar -b {{1}}`
* Report a total of 10 network device statistics, one per 2 seconds:
`sar -n DEV {{2}} {{10}}`
* Report CPU utilization, one per 2 seconds:
`sar -u ALL {{2}}`
* Report a total of 20 memory utilization statistics, one per second:
`sar -r ALL {{1}} {{20}}`
* Report the run queue length and load averages, one per second:
`sar -q {{1}}`
* Report paging statistics, one per 5 seconds:
`sar -B {{5}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | env | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | g++ | # g++
> Compiles C++ source files. Part of GCC (GNU Compiler Collection). More
> information: https://gcc.gnu.org.
* Compile a source code file into an executable binary:
`g++ {{path/to/source.cpp}} -o {{path/to/output_executable}}`
* Display common warnings:
`g++ {{path/to/source.cpp}} -Wall -o {{path/to/output_executable}}`
* Choose a language standard to compile for (C++98/C++11/C++14/C++17):
`g++ {{path/to/source.cpp}} -std={{c++98|c++11|c++14|c++17}} -o
{{path/to/output_executable}}`
* Include libraries located at a different path than the source file:
`g++ {{path/to/source.cpp}} -o {{path/to/output_executable}}
-I{{path/to/header}} -L{{path/to/library}} -l{{library_name}}`
* Compile and link multiple source code files into an executable binary:
`g++ -c {{path/to/source_1.cpp path/to/source_2.cpp ...}} && g++ -o
{{path/to/output_executable}} {{path/to/source_1.o path/to/source_2.o ...}}`
* Display version:
`g++ --version` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | who | # who
> Display who is logged in and related data (processes, boot time). More
> information: https://www.gnu.org/software/coreutils/who.
* Display the username, line, and time of all currently logged-in sessions:
`who`
* Display information only for the current terminal session:
`who am i`
* Display all available information:
`who -a`
* Display all available information with table headers:
`who -a -H` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | dot | # 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 -?` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | cat | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | dir | # dir
> List directory contents using one line per file, special characters are
> represented by backslash escape sequences. Works as `ls -C --escape`. More
> information: https://manned.org/dir.
* List all files, including hidden files:
`dir -all`
* List files including their author (`-l` is required):
`dir -l --author`
* List files excluding those that match a specified blob pattern:
`dir --hide={{pattern}}`
* List subdirectories recursively:
`dir --recursive`
* Display help:
`dir --help` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | lex | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | tee | # tee
> Read from `stdin` and write to `stdout` and files (or commands). More
> information: https://www.gnu.org/software/coreutils/tee.
* Copy `stdin` to each file, and also to `stdout`:
`echo "example" | tee {{path/to/file}}`
* Append to the given files, do not overwrite:
`echo "example" | tee -a {{path/to/file}}`
* Print `stdin` to the terminal, and also pipe it into another program for further processing:
`echo "example" | tee {{/dev/tty}} | {{xargs printf "[%s]"}}`
* Create a directory called "example", count the number of characters in "example" and write "example" to the terminal:
`echo "example" | tee >(xargs mkdir) >(wc -c)` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | sort | # 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}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | shuf | # shuf
> Generate random permutations. More information: https://www.unix.com/man-
> page/linux/1/shuf/.
* Randomize the order of lines in a file and output the result:
`shuf {{filename}}`
* Only output the first 5 entries of the result:
`shuf --head-count={{5}} {{filename}}`
* Write output to another file:
`shuf {{filename}} --output={{output_filename}}`
* Generate random numbers in range 1-10:
`shuf --input-range={{1-10}}` |
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked. | stat | # stat
> Display file status. More information: https://ss64.com/osx/stat.html.
* Show file properties such as size, permissions, creation and access dates among others:
`stat {{path/to/file}}`
* Same as above but verbose (more similar to Linux's `stat`):
`stat -x {{path/to/file}}`
* Show only octal file permissions:
`stat -f %Mp%Lp {{path/to/file}}`
* Show owner and group of the file:
`stat -f "%Su %Sg" {{path/to/file}}`
* Show the size of the file in bytes:
`stat -f "%z %N" {{path/to/file}}` |