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.
|
echo
|
# 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 $?`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
nice
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
date
|
# date
> Set or display the system date. More information:
> https://ss64.com/osx/date.html.
* Display the current date using the default locale's format:
`date +%c`
* Display the current date in UTC and ISO 8601 format:
`date -u +%Y-%m-%dT%H:%M:%SZ`
* Display the current date as a Unix timestamp (seconds since the Unix epoch):
`date +%s`
* Display a specific date (represented as a Unix timestamp) using the default format:
`date -r 1473305798`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
chfn
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
vdir
|
# vdir
> List directory contents. Drop-in replacement for `ls -l`. More information:
> https://www.gnu.org/software/coreutils/vdir.
* List files and directories in the current directory, one per line, with details:
`vdir`
* List with sizes displayed in human-readable units (KB, MB, GB):
`vdir -h`
* List including hidden files (starting with a dot):
`vdir -a`
* List files and directories sorting entries by size (largest first):
`vdir -S`
* List files and directories sorting entries by modification time (newest first):
`vdir -t`
* List grouping directories first:
`vdir --group-directories-first`
* Recursively list all files and directories in a specific directory:
`vdir --recursive {{path/to/directory}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
uniq
|
# uniq
> Output the unique lines from the given input or file. Since it does not
> detect repeated lines unless they are adjacent, we need to sort them first.
> More information: https://www.gnu.org/software/coreutils/uniq.
* Display each line once:
`sort {{path/to/file}} | uniq`
* Display only unique lines:
`sort {{path/to/file}} | uniq -u`
* Display only duplicate lines:
`sort {{path/to/file}} | uniq -d`
* Display number of occurrences of each line along with that line:
`sort {{path/to/file}} | uniq -c`
* Display number of occurrences of each line, sorted by the most frequent:
`sort {{path/to/file}} | uniq -c | sort -nr`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
dpkg
|
# dpkg
> Debian package manager. Some subcommands such as `dpkg deb` have their own
> usage documentation. For equivalent commands in other package managers, see
> https://wiki.archlinux.org/title/Pacman/Rosetta. More information:
> https://manpages.debian.org/latest/dpkg/dpkg.html.
* Install a package:
`dpkg -i {{path/to/file.deb}}`
* Remove a package:
`dpkg -r {{package}}`
* List installed packages:
`dpkg -l {{pattern}}`
* List a package's contents:
`dpkg -L {{package}}`
* List contents of a local package file:
`dpkg -c {{path/to/file.deb}}`
* Find out which package owns a file:
`dpkg -S {{path/to/file}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
gcov
|
# gcov
> Code coverage analysis and profiling tool that discovers untested parts of a
> program. Also displays a copy of source code annotated with execution
> frequencies of code segments. More information:
> https://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html.
* Generate a coverage report named `file.cpp.gcov`:
`gcov {{path/to/file.cpp}}`
* Write individual execution counts for every basic block:
`gcov --all-blocks {{path/to/file.cpp}}`
* Write branch frequencies to the output file and print summary information to `stdout` as a percentage:
`gcov --branch-probabilities {{path/to/file.cpp}}`
* Write branch frequencies as the number of branches taken, rather than the percentage:
`gcov --branch-counts {{path/to/file.cpp}}`
* Do not create a `gcov` output file:
`gcov --no-output {{path/to/file.cpp}}`
* Write file level as well as function level summaries:
`gcov --function-summaries {{path/to/file.cpp}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
expr
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
mesg
|
# mesg
> Check or set a terminal's ability to receive messages from other users,
> usually from the write command. See also `write`. More information:
> https://manned.org/mesg.
* Check terminal's openness to write messages:
`mesg`
* Disable receiving messages from the write command:
`mesg n`
* Enable receiving messages from the write command:
`mesg y`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
diff
|
# diff
> Compare files and directories. More information: https://man7.org/linux/man-
> pages/man1/diff.1.html.
* Compare files (lists changes to turn `old_file` into `new_file`):
`diff {{old_file}} {{new_file}}`
* Compare files, ignoring white spaces:
`diff --ignore-all-space {{old_file}} {{new_file}}`
* Compare files, showing the differences side by side:
`diff --side-by-side {{old_file}} {{new_file}}`
* Compare files, showing the differences in unified format (as used by `git diff`):
`diff --unified {{old_file}} {{new_file}}`
* Compare directories recursively (shows names for differing files/directories as well as changes made to files):
`diff --recursive {{old_directory}} {{new_directory}}`
* Compare directories, only showing the names of files that differ:
`diff --recursive --brief {{old_directory}} {{new_directory}}`
* Create a patch file for Git from the differences of two text files, treating nonexistent files as empty:
`diff --text --unified --new-file {{old_file}} {{new_file}} > {{diff.patch}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
stty
|
# stty
> Set options for a terminal device interface. More information:
> https://www.gnu.org/software/coreutils/stty.
* Display all settings for the current terminal:
`stty --all`
* Set the number of rows or columns:
`stty {{rows|cols}} {{count}}`
* Get the actual transfer speed of a device:
`stty --file {{path/to/device_file}} speed`
* Reset all modes to reasonable values for the current terminal:
`stty sane`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
make
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
gawk
|
# gawk
> This command is an alias of GNU `awk`.
* View documentation for the original command:
`tldr -p linux awk`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
trap
|
# trap
> Automatically execute commands after receiving signals by processes or the
> operating system. Can be used to perform cleanups for interruptions by the
> user or other actions. More information: https://manned.org/trap.
* List available signals to set traps for:
`trap -l`
* List active traps for the current shell:
`trap -p`
* Set a trap to execute commands when one or more signals are detected:
`trap 'echo "Caught signal {{SIGHUP}}"' {{SIGHUP}}`
* Remove active traps:
`trap - {{SIGHUP}} {{SIGINT}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
arch
|
# 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}}"`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
kill
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
find
|
# find
> Find files or directories under the given directory tree, recursively. More
> information: https://manned.org/find.
* Find files by extension:
`find {{root_path}} -name '{{*.ext}}'`
* Find files matching multiple path/name patterns:
`find {{root_path}} -path '{{**/path/**/*.ext}}' -or -name '{{*pattern*}}'`
* Find directories matching a given name, in case-insensitive mode:
`find {{root_path}} -type d -iname '{{*lib*}}'`
* Find files matching a given pattern, excluding specific paths:
`find {{root_path}} -name '{{*.py}}' -not -path '{{*/site-packages/*}}'`
* Find files matching a given size range, limiting the recursive depth to "1":
`find {{root_path}} -maxdepth 1 -size {{+500k}} -size {{-10M}}`
* Run a command for each file (use `{}` within the command to access the filename):
`find {{root_path}} -name '{{*.ext}}' -exec {{wc -l {} }}\;`
* Find files modified in the last 7 days:
`find {{root_path}} -daystart -mtime -{{7}}`
* Find empty (0 byte) files and delete them:
`find {{root_path}} -type {{f}} -empty -delete`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
head
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
fold
|
# 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}}`
|
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.
|
wget
|
# wget
> Download files from the Web. Supports HTTP, HTTPS, and FTP. More
> information: https://www.gnu.org/software/wget.
* Download the contents of a URL to a file (named "foo" in this case):
`wget {{https://example.com/foo}}`
* Download the contents of a URL to a file (named "bar" in this case):
`wget --output-document {{bar}} {{https://example.com/foo}}`
* Download a single web page and all its resources with 3-second intervals between requests (scripts, stylesheets, images, etc.):
`wget --page-requisites --convert-links --wait=3
{{https://example.com/somepage.html}}`
* Download all listed files within a directory and its sub-directories (does not download embedded page elements):
`wget --mirror --no-parent {{https://example.com/somepath/}}`
* Limit the download speed and the number of connection retries:
`wget --limit-rate={{300k}} --tries={{100}} {{https://example.com/somepath/}}`
* Download a file from an HTTP server using Basic Auth (also works for FTP):
`wget --user={{username}} --password={{password}} {{https://example.com}}`
* Continue an incomplete download:
`wget --continue {{https://example.com}}`
* Download all URLs stored in a text file to a specific directory:
`wget --directory-prefix {{path/to/directory}} --input-file {{URLs.txt}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
kill
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
date
|
# date
> Set or display the system date. More information:
> https://ss64.com/osx/date.html.
* Display the current date using the default locale's format:
`date +%c`
* Display the current date in UTC and ISO 8601 format:
`date -u +%Y-%m-%dT%H:%M:%SZ`
* Display the current date as a Unix timestamp (seconds since the Unix epoch):
`date +%s`
* Display a specific date (represented as a Unix timestamp) using the default format:
`date -r 1473305798`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
kill
|
# 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}}`
|
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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
jobs
|
# jobs
> Display status of jobs in the current session. More information:
> https://manned.org/jobs.
* Show status of all jobs:
`jobs`
* Show status of a particular job:
`jobs %{{job_id}}`
* Show status and process IDs of all jobs:
`jobs -l`
* Show process IDs of all jobs:
`jobs -p`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
echo
|
# 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 $?`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
fold
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
exit
|
# exit
> Exit the shell. More information: https://manned.org/exit.
* Exit the shell with the exit code of the last command executed:
`exit`
* Exit the shell with the specified exit code:
`exit {{exit_code}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
bash
|
# bash
> Bourne-Again SHell, an `sh`-compatible command-line interpreter. See also:
> `zsh`, `histexpand` (history expansion). More information:
> https://gnu.org/software/bash/.
* Start an interactive shell session:
`bash`
* Start an interactive shell session without loading startup configs:
`bash --norc`
* Execute specific [c]ommands:
`bash -c "{{echo 'bash is executed'}}"`
* Execute a specific script:
`bash {{path/to/script.sh}}`
* Execute a specific script while printing each command before executing it:
`bash -x {{path/to/script.sh}}`
* Execute a specific script and stop at the first [e]rror:
`bash -e {{path/to/script.sh}}`
* Execute specific commands from `stdin`:
`{{echo "echo 'bash is executed'"}} | bash`
* Start a [r]estricted shell session:
`bash -r`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
find
|
# find
> Find files or directories under the given directory tree, recursively. More
> information: https://manned.org/find.
* Find files by extension:
`find {{root_path}} -name '{{*.ext}}'`
* Find files matching multiple path/name patterns:
`find {{root_path}} -path '{{**/path/**/*.ext}}' -or -name '{{*pattern*}}'`
* Find directories matching a given name, in case-insensitive mode:
`find {{root_path}} -type d -iname '{{*lib*}}'`
* Find files matching a given pattern, excluding specific paths:
`find {{root_path}} -name '{{*.py}}' -not -path '{{*/site-packages/*}}'`
* Find files matching a given size range, limiting the recursive depth to "1":
`find {{root_path}} -maxdepth 1 -size {{+500k}} -size {{-10M}}`
* Run a command for each file (use `{}` within the command to access the filename):
`find {{root_path}} -name '{{*.ext}}' -exec {{wc -l {} }}\;`
* Find files modified in the last 7 days:
`find {{root_path}} -daystart -mtime -{{7}}`
* Find empty (0 byte) files and delete them:
`find {{root_path}} -type {{f}} -empty -delete`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
wall
|
# wall
> Write a message on the terminals of users currently logged in. More
> information: https://manned.org/wall.
* Send a message:
`wall {{message}}`
* Send a message to users that belong to a specific group:
`wall --group {{group_name}} {{message}}`
* Send a message from a file:
`wall {{file}}`
* Send a message with timeout (default 300):
`wall --timeout {{seconds}} {{file}}`
|
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.
|
ipcs
|
# ipcs
> Display information about resources used in IPC (Inter-process
> Communication). More information: https://manned.org/ipcs.
* Specific information about the Message Queue which has the ID 32768:
`ipcs -qi 32768`
* General information about all the IPC:
`ipcs -a`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
chsh
|
# chsh
> Change user's login shell. More information: https://manned.org/chsh.
* Set a specific login shell for the current user interactively:
`chsh`
* Set a specific login [s]hell for the current user:
`chsh -s {{path/to/shell}}`
* Set a login [s]hell for a specific user:
`chsh -s {{path/to/shell}} {{username}}`
* [l]ist available shells:
`chsh -l`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
tail
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
sftp
|
# sftp
> Secure File Transfer Program. Interactive program to copy files between
> hosts over SSH. For non-interactive file transfers, see `scp` or `rsync`.
> More information: https://manned.org/sftp.
* Connect to a remote server and enter an interactive command mode:
`sftp {{remote_user}}@{{remote_host}}`
* Connect using an alternate port:
`sftp -P {{remote_port}} {{remote_user}}@{{remote_host}}`
* Connect using a predefined host (in `~/.ssh/config`):
`sftp {{host}}`
* Transfer remote file to the local system:
`get {{/path/remote_file}}`
* Transfer local file to the remote system:
`put {{/path/local_file}}`
* Transfer remote directory to the local system recursively (works with `put` too):
`get -R {{/path/remote_directory}}`
* Get list of files on local machine:
`lls`
* Get list of files on remote machine:
`ls`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
free
|
# free
> Display amount of free and used memory in the system. More information:
> https://manned.org/free.
* Display system memory:
`free`
* Display memory in Bytes/KB/MB/GB:
`free -{{b|k|m|g}}`
* Display memory in human-readable units:
`free -h`
* Refresh the output every 2 seconds:
`free -s {{2}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
join
|
# join
> Join lines of two sorted files on a common field. More information:
> https://www.gnu.org/software/coreutils/join.
* Join two files on the first (default) field:
`join {{file1}} {{file2}}`
* Join two files using a comma (instead of a space) as the field separator:
`join -t {{','}} {{file1}} {{file2}}`
* Join field3 of file1 with field1 of file2:
`join -1 {{3}} -2 {{1}} {{file1}} {{file2}}`
* Produce a line for each unpairable line for file1:
`join -a {{1}} {{file1}} {{file2}}`
* Join a file from `stdin`:
`cat {{path/to/file1}} | join - {{path/to/file2}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
nice
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
head
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
more
|
# 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`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
comm
|
# comm
> Select or reject lines common to two files. Both files must be sorted. More
> information: https://www.gnu.org/software/coreutils/comm.
* Produce three tab-separated columns: lines only in first file, lines only in second file and common lines:
`comm {{file1}} {{file2}}`
* Print only lines common to both files:
`comm -12 {{file1}} {{file2}}`
* Print only lines common to both files, reading one file from `stdin`:
`cat {{file1}} | comm -12 - {{file2}}`
* Get lines only found in first file, saving the result to a third file:
`comm -23 {{file1}} {{file2}} > {{file1_only}}`
* Print lines only found in second file, when the files aren't sorted:
`comm -13 <(sort {{file1}}) <(sort {{file2}})`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
chfn
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
sync
|
# sync
> Flushes all pending write operations to the appropriate disks. More
> information: https://www.gnu.org/software/coreutils/sync.
* Flush all pending write operations on all disks:
`sync`
* Flush all pending write operations on a single file to disk:
`sync {{path/to/file}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
link
|
# link
> Create a hard link to an existing file. For more options, see the `ln`
> command. More information: https://www.gnu.org/software/coreutils/link.
* Create a hard link from a new file to an existing file:
`link {{path/to/existing_file}} {{path/to/new_file}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
file
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
chsh
|
# chsh
> Change user's login shell. More information: https://manned.org/chsh.
* Set a specific login shell for the current user interactively:
`chsh`
* Set a specific login [s]hell for the current user:
`chsh -s {{path/to/shell}}`
* Set a login [s]hell for a specific user:
`chsh -s {{path/to/shell}} {{username}}`
* [l]ist available shells:
`chsh -l`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
less
|
# less
> Open a file for interactive reading, allowing scrolling and search. More
> information: https://greenwoodsoftware.com/less/.
* Open a file:
`less {{source_file}}`
* Page down/up:
`<Space> (down), b (up)`
* Go to end/start of file:
`G (end), g (start)`
* Forward search for a string (press `n`/`N` to go to next/previous match):
`/{{something}}`
* Backward search for a string (press `n`/`N` to go to next/previous match):
`?{{something}}`
* Follow the output of the currently opened file:
`F`
* Open the current file in an editor:
`v`
* Exit:
`q`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
file
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
uniq
|
# uniq
> Output the unique lines from the given input or file. Since it does not
> detect repeated lines unless they are adjacent, we need to sort them first.
> More information: https://www.gnu.org/software/coreutils/uniq.
* Display each line once:
`sort {{path/to/file}} | uniq`
* Display only unique lines:
`sort {{path/to/file}} | uniq -u`
* Display only duplicate lines:
`sort {{path/to/file}} | uniq -d`
* Display number of occurrences of each line along with that line:
`sort {{path/to/file}} | uniq -c`
* Display number of occurrences of each line, sorted by the most frequent:
`sort {{path/to/file}} | uniq -c | sort -nr`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
true
|
# true
> Returns a successful exit status code of 0. Use this with the || operator to
> make a command always exit with 0. More information:
> https://www.gnu.org/software/coreutils/true.
* Return a successful exit code:
`true`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
wait
|
# wait
> Wait for a process to complete before proceeding. More information:
> https://manned.org/wait.
* Wait for a process to finish given its process ID (PID) and return its exit status:
`wait {{pid}}`
* Wait for all processes known to the invoking shell to finish:
`wait`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
curl
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
more
|
# 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`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
look
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
join
|
# join
> Join lines of two sorted files on a common field. More information:
> https://www.gnu.org/software/coreutils/join.
* Join two files on the first (default) field:
`join {{file1}} {{file2}}`
* Join two files using a comma (instead of a space) as the field separator:
`join -t {{','}} {{file1}} {{file2}}`
* Join field3 of file1 with field1 of file2:
`join -1 {{3}} -2 {{1}} {{file1}} {{file2}}`
* Produce a line for each unpairable line for file1:
`join -a {{1}} {{file1}} {{file2}}`
* Join a file from `stdin`:
`cat {{path/to/file1}} | join - {{path/to/file2}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
mesg
|
# mesg
> Check or set a terminal's ability to receive messages from other users,
> usually from the write command. See also `write`. More information:
> https://manned.org/mesg.
* Check terminal's openness to write messages:
`mesg`
* Disable receiving messages from the write command:
`mesg n`
* Enable receiving messages from the write command:
`mesg y`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
diff
|
# diff
> Compare files and directories. More information: https://man7.org/linux/man-
> pages/man1/diff.1.html.
* Compare files (lists changes to turn `old_file` into `new_file`):
`diff {{old_file}} {{new_file}}`
* Compare files, ignoring white spaces:
`diff --ignore-all-space {{old_file}} {{new_file}}`
* Compare files, showing the differences side by side:
`diff --side-by-side {{old_file}} {{new_file}}`
* Compare files, showing the differences in unified format (as used by `git diff`):
`diff --unified {{old_file}} {{new_file}}`
* Compare directories recursively (shows names for differing files/directories as well as changes made to files):
`diff --recursive {{old_directory}} {{new_directory}}`
* Compare directories, only showing the names of files that differ:
`diff --recursive --brief {{old_directory}} {{new_directory}}`
* Create a patch file for Git from the differences of two text files, treating nonexistent files as empty:
`diff --text --unified --new-file {{old_file}} {{new_file}} > {{diff.patch}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
make
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
time
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
dash
|
# 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`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
htop
|
# htop
> Display dynamic real-time information about running processes. An enhanced
> version of `top`. More information: https://htop.dev/.
* Start `htop`:
`htop`
* Start `htop` displaying processes owned by a specific user:
`htop --user {{username}}`
* Sort processes by a specified `sort_item` (use `htop --sort help` for available options):
`htop --sort {{sort_item}}`
* See interactive commands while running htop:
`?`
* Switch to a different tab:
`tab`
* Display help:
`htop --help`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
pmap
|
# pmap
> Report memory map of a process or processes. More information:
> https://manned.org/pmap.
* Print memory map for a specific process id (PID):
`pmap {{pid}}`
* Show the extended format:
`pmap --extended {{pid}}`
* Show the device format:
`pmap --device {{pid}}`
* Limit results to a memory address range specified by `low` and `high`:
`pmap --range {{low}},{{high}}`
* Print memory maps for multiple processes:
`pmap {{pid1 pid2 ...}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
test
|
# 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"}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
yacc
|
# yacc
> Generate an LALR parser (in C) with a given formal grammar specification
> file. See also: `bison`. More information: https://manned.org/man/yacc.1p.
* Create a file `y.tab.c` containing the C parser code and compile the grammar file with all necessary constant declarations for values. (Constant declarations file `y.tab.h` is created only when the `-d` flag is used):
`yacc -d {{path/to/grammar_file.y}}`
* Compile a grammar file containing the description of the parser and a report of conflicts generated by ambiguities in the grammar:
`yacc -d {{path/to/grammar_file.y}} -v`
* Compile a grammar file, and prefix output filenames with `prefix` instead of `y`:
`yacc -d {{path/to/grammar_file.y}} -v -b {{prefix}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
grep
|
# grep
> Find patterns in files using regular expressions. More information:
> https://www.gnu.org/software/grep/manual/grep.html.
* Search for a pattern within a file:
`grep "{{search_pattern}}" {{path/to/file}}`
* Search for an exact string (disables regular expressions):
`grep --fixed-strings "{{exact_string}}" {{path/to/file}}`
* Search for a pattern in all files recursively in a directory, showing line numbers of matches, ignoring binary files:
`grep --recursive --line-number --binary-files={{without-match}}
"{{search_pattern}}" {{path/to/directory}}`
* Use extended regular expressions (supports `?`, `+`, `{}`, `()` and `|`), in case-insensitive mode:
`grep --extended-regexp --ignore-case "{{search_pattern}}" {{path/to/file}}`
* Print 3 lines of context around, before, or after each match:
`grep --{{context|before-context|after-context}}={{3}} "{{search_pattern}}"
{{path/to/file}}`
* Print file name and line number for each match with color output:
`grep --with-filename --line-number --color=always "{{search_pattern}}"
{{path/to/file}}`
* Search for lines matching a pattern, printing only the matched text:
`grep --only-matching "{{search_pattern}}" {{path/to/file}}`
* Search `stdin` for lines that do not match a pattern:
`cat {{path/to/file}} | grep --invert-match "{{search_pattern}}"`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
kill
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
test
|
# 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"}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
tput
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
last
|
# 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`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
tail
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
type
|
# type
> Display the type of command the shell will execute. More information:
> https://manned.org/type.
* Display the type of a command:
`type {{command}}`
* Display all locations containing the specified executable:
`type -a {{command}}`
* Display the name of the disk file that would be executed:
`type -p {{command}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
size
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
link
|
# link
> Create a hard link to an existing file. For more options, see the `ln`
> command. More information: https://www.gnu.org/software/coreutils/link.
* Create a hard link from a new file to an existing file:
`link {{path/to/existing_file}} {{path/to/new_file}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
chrt
|
# chrt
> Manipulate the real-time attributes of a process. More information:
> https://man7.org/linux/man-pages/man1/chrt.1.html.
* Display attributes of a process:
`chrt --pid {{PID}}`
* Display attributes of all threads of a process:
`chrt --all-tasks --pid {{PID}}`
* Display the min/max priority values that can be used with `chrt`:
`chrt --max`
* Set the scheduling policy for a process:
`chrt --pid {{PID}} --{{deadline|idle|batch|rr|fifo|other}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
perf
|
# perf
> Framework for Linux performance counter measurements. More information:
> https://perf.wiki.kernel.org.
* Display basic performance counter stats for a command:
`perf stat {{gcc hello.c}}`
* Display system-wide real-time performance counter profile:
`sudo perf top`
* Run a command and record its profile into `perf.data`:
`sudo perf record {{command}}`
* Record the profile of an existing process into `perf.data`:
`sudo perf record -p {{pid}}`
* Read `perf.data` (created by `perf record`) and display the profile:
`sudo perf report`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
tput
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
grep
|
# grep
> Find patterns in files using regular expressions. More information:
> https://www.gnu.org/software/grep/manual/grep.html.
* Search for a pattern within a file:
`grep "{{search_pattern}}" {{path/to/file}}`
* Search for an exact string (disables regular expressions):
`grep --fixed-strings "{{exact_string}}" {{path/to/file}}`
* Search for a pattern in all files recursively in a directory, showing line numbers of matches, ignoring binary files:
`grep --recursive --line-number --binary-files={{without-match}}
"{{search_pattern}}" {{path/to/directory}}`
* Use extended regular expressions (supports `?`, `+`, `{}`, `()` and `|`), in case-insensitive mode:
`grep --extended-regexp --ignore-case "{{search_pattern}}" {{path/to/file}}`
* Print 3 lines of context around, before, or after each match:
`grep --{{context|before-context|after-context}}={{3}} "{{search_pattern}}"
{{path/to/file}}`
* Print file name and line number for each match with color output:
`grep --with-filename --line-number --color=always "{{search_pattern}}"
{{path/to/file}}`
* Search for lines matching a pattern, printing only the matched text:
`grep --only-matching "{{search_pattern}}" {{path/to/file}}`
* Search `stdin` for lines that do not match a pattern:
`cat {{path/to/file}} | grep --invert-match "{{search_pattern}}"`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
stty
|
# stty
> Set options for a terminal device interface. More information:
> https://www.gnu.org/software/coreutils/stty.
* Display all settings for the current terminal:
`stty --all`
* Set the number of rows or columns:
`stty {{rows|cols}} {{count}}`
* Get the actual transfer speed of a device:
`stty --file {{path/to/device_file}} speed`
* Reset all modes to reasonable values for the current terminal:
`stty sane`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
gitk
|
# 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`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
time
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
comm
|
# comm
> Select or reject lines common to two files. Both files must be sorted. More
> information: https://www.gnu.org/software/coreutils/comm.
* Produce three tab-separated columns: lines only in first file, lines only in second file and common lines:
`comm {{file1}} {{file2}}`
* Print only lines common to both files:
`comm -12 {{file1}} {{file2}}`
* Print only lines common to both files, reading one file from `stdin`:
`cat {{file1}} | comm -12 - {{file2}}`
* Get lines only found in first file, saving the result to a third file:
`comm -23 {{file1}} {{file2}} > {{file1_only}}`
* Print lines only found in second file, when the files aren't sorted:
`comm -13 <(sort {{file1}}) <(sort {{file2}})`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
quota
|
# quota
> Display users' disk space usage and allocated limits. More information:
> https://manned.org/quota.
* Show disk quotas in human-readable units for the current user:
`quota -s`
* Verbose output (also display quotas on filesystems where no storage is allocated):
`quota -v`
* Quiet output (only display quotas on filesystems where usage is over quota):
`quota -q`
* Print quotas for the groups of which the current user is a member:
`quota -g`
* Show disk quotas for another user:
`sudo quota -u {{username}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
write
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
mailx
|
# 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}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
clear
|
# 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`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
tsort
|
# 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`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
sshfs
|
# sshfs
> Filesystem client based on SSH. More information:
> https://github.com/libfuse/sshfs.
* Mount remote directory:
`sshfs {{username}}@{{remote_host}}:{{remote_directory}} {{mountpoint}}`
* Unmount remote directory:
`umount {{mountpoint}}`
* Mount remote directory from server with specific port:
`sshfs {{username}}@{{remote_host}}:{{remote_directory}} -p {{2222}}`
* Use compression:
`sshfs {{username}}@{{remote_host}}:{{remote_directory}} -C`
* Follow symbolic links:
`sshfs -o follow_symlinks {{username}}@{{remote_host}}:{{remote_directory}}
{{mountpoint}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
quilt
|
# quilt
> Tool to manage a series of patches. More information:
> https://savannah.nongnu.org/projects/quilt.
* Import an existing patch from a file:
`quilt import {{path/to/filename.patch}}`
* Create a new patch:
`quilt new {{filename.patch}}`
* Add a file to the current patch:
`quilt add {{path/to/file}}`
* After editing the file, refresh the current patch with the changes:
`quilt refresh`
* Apply all the patches in the series file:
`quilt push -a`
* Remove all applied patches:
`quilt pop -a`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
diff3
|
# diff3
> Compare three files line by line. More information:
> https://www.gnu.org/software/diffutils/manual/html_node/Invoking-diff3.html.
* Compare files:
`diff3 {{path/to/file1}} {{path/to/file2}} {{path/to/file3}}`
* Show all changes, outlining conflicts:
`diff3 --show-all {{path/to/file1}} {{path/to/file2}} {{path/to/file3}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
rmdir
|
# 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 ...}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
xargs
|
# xargs
> Execute a command with piped arguments coming from another command, a file,
> etc. The input is treated as a single block of text and split into separate
> pieces on spaces, tabs, newlines and end-of-file. More information:
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html.
* Run a command using the input data as arguments:
`{{arguments_source}} | xargs {{command}}`
* Run multiple chained commands on the input data:
`{{arguments_source}} | xargs sh -c "{{command1}} && {{command2}} |
{{command3}}"`
* Delete all files with a `.backup` extension (`-print0` uses a null character to split file names, and `-0` uses it as delimiter):
`find . -name {{'*.backup'}} -print0 | xargs -0 rm -v`
* Execute the command once for each input line, replacing any occurrences of the placeholder (here marked as `_`) with the input line:
`{{arguments_source}} | xargs -I _ {{command}} _ {{optional_extra_arguments}}`
* Parallel runs of up to `max-procs` processes at a time; the default is 1. If `max-procs` is 0, xargs will run as many processes as possible at a time:
`{{arguments_source}} | xargs -P {{max-procs}} {{command}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
chmod
|
# chmod
> Change the access permissions of a file or directory. More information:
> https://www.gnu.org/software/coreutils/chmod.
* Give the [u]ser who owns a file the right to e[x]ecute it:
`chmod u+x {{path/to/file}}`
* Give the [u]ser rights to [r]ead and [w]rite to a file/directory:
`chmod u+rw {{path/to/file_or_directory}}`
* Remove e[x]ecutable rights from the [g]roup:
`chmod g-x {{path/to/file}}`
* Give [a]ll users rights to [r]ead and e[x]ecute:
`chmod a+rx {{path/to/file}}`
* Give [o]thers (not in the file owner's group) the same rights as the [g]roup:
`chmod o=g {{path/to/file}}`
* Remove all rights from [o]thers:
`chmod o= {{path/to/file}}`
* Change permissions recursively giving [g]roup and [o]thers the ability to [w]rite:
`chmod -R g+w,o+w {{path/to/directory}}`
* Recursively give [a]ll users [r]ead permissions to files and e[X]ecute permissions to sub-directories within a directory:
`chmod -R a+rX {{path/to/directory}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
egrep
|
# egrep
> Find patterns in files using extended regular expression (supports `?`, `+`,
> `{}`, `()` and `|`). More information: https://manned.org/egrep.
* Search for a pattern within a file:
`egrep "{{search_pattern}}" {{path/to/file}}`
* Search for a pattern within multiple files:
`egrep "{{search_pattern}}" {{path/to/file1}} {{path/to/file2}}
{{path/to/file3}}`
* Search `stdin` for a pattern:
`cat {{path/to/file}} | egrep {{search_pattern}}`
* Print file name and line number for each match:
`egrep --with-filename --line-number "{{search_pattern}}" {{path/to/file}}`
* Search for a pattern in all files recursively in a directory, ignoring binary files:
`egrep --recursive --binary-files={{without-match}} "{{search_pattern}}"
{{path/to/directory}}`
* Search for lines that do not match a pattern:
`egrep --invert-match "{{search_pattern}}" {{path/to/file}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
chown
|
# chown
> Change user and group ownership of files and directories. More information:
> https://www.gnu.org/software/coreutils/chown.
* Change the owner user of a file/directory:
`chown {{user}} {{path/to/file_or_directory}}`
* Change the owner user and group of a file/directory:
`chown {{user}}:{{group}} {{path/to/file_or_directory}}`
* Recursively change the owner of a directory and its contents:
`chown -R {{user}} {{path/to/directory}}`
* Change the owner of a symbolic link:
`chown -h {{user}} {{path/to/symlink}}`
* Change the owner of a file/directory to match a reference file:
`chown --reference={{path/to/reference_file}} {{path/to/file_or_directory}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
paste
|
# paste
> Merge lines of files. More information:
> https://www.gnu.org/software/coreutils/paste.
* Join all the lines into a single line, using TAB as delimiter:
`paste -s {{path/to/file}}`
* Join all the lines into a single line, using the specified delimiter:
`paste -s -d {{delimiter}} {{path/to/file}}`
* Merge two files side by side, each in its column, using TAB as delimiter:
`paste {{file1}} {{file2}}`
* Merge two files side by side, each in its column, using the specified delimiter:
`paste -d {{delimiter}} {{file1}} {{file2}}`
* Merge two files, with lines added alternatively:
`paste -d '\n' {{file1}} {{file2}}`
|
You are a linux expert. You understand what every Linux terminal command does and you reply with the explanation when asked.
|
ipcrm
|
# ipcrm
> Delete IPC (Inter-process Communication) resources. More information:
> https://manned.org/ipcrm.
* Delete a shared memory segment by ID:
`ipcrm --shmem-id {{shmem_id}}`
* Delete a shared memory segment by key:
`ipcrm --shmem-key {{shmem_key}}`
* Delete an IPC queue by ID:
`ipcrm --queue-id {{ipc_queue_id}}`
* Delete an IPC queue by key:
`ipcrm --queue-key {{ipc_queue_key}}`
* Delete a semaphore by ID:
`ipcrm --semaphore-id {{semaphore_id}}`
* Delete a semaphore by key:
`ipcrm --semaphore-key {{semaphore_key}}`
* Delete all IPC resources:
`ipcrm --all`
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.