File tree Expand file tree Collapse file tree 14 files changed +43
-15
lines changed Expand file tree Collapse file tree 14 files changed +43
-15
lines changed Original file line number Diff line number Diff line change 1
1
# alias
2
2
3
3
> Create aliases - words that are replaced by a command string.
4
- > Aliases expire with the current shell session unless defined in the shell's configuration file, e.g. ` ~/.bashrc ` .
5
- > More information: < https://tldp.org/LDP/abs/html/aliases.html > .
4
+ > Aliases expire with the current shell session unless defined in the shell's configuration file, e.g. ` ~/.bashrc ` for Bash or ` ~/.zshrc ` for Zsh.
5
+ > See also: ` unalias ` .
6
+ > More information: < https://manned.org/alias > .
6
7
7
8
- List all aliases:
8
9
Original file line number Diff line number Diff line change 1
1
# bg
2
2
3
3
> Resume suspended jobs (e.g. using ` <Ctrl z> ` ), and keeps them running in the background.
4
+ > See also: ` jobs ` , ` fg ` and ` disown ` .
4
5
> More information: < https://manned.org/bg > .
5
6
6
7
- Resume the most recently suspended job and run it in the background:
7
8
8
9
` bg `
9
10
10
- - Resume a specific job (use ` jobs -l ` to get its ID) and run it in the background :
11
+ - Resume a specific job and run it in the background ( run ` jobs ` to find the job number) :
11
12
12
- ` bg %{{job_id }} `
13
+ ` bg %{{job_number }} `
Original file line number Diff line number Diff line change 7
7
8
8
` command {{ls}} `
9
9
10
+ - Find and execute a command using a default ` $PATH ` (` /bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/etc ` ) that guarantees to find all standard utilities:
11
+
12
+ ` command -p {{command_name}} `
13
+
10
14
- Display the path to the executable or the alias definition of a specific command:
11
15
12
16
` command -v {{command_name}} `
Original file line number Diff line number Diff line change 2
2
3
3
> Display or manipulate the directory stack.
4
4
> The directory stack is a list of recently visited directories that can be manipulated with the ` pushd ` and ` popd ` commands.
5
+ > See also: ` pushd ` , ` popd ` .
5
6
> More information: < https://www.gnu.org/software/bash/manual/bash.html#Directory-Stack-Builtins > .
6
7
7
8
- Display the directory stack with a space between each entry:
12
13
13
14
` dirs -p `
14
15
15
- - Display only the ` n ` th entry in the directory stack, starting at 0:
16
+ - Display a numbered list of entries in the directory stack:
17
+
18
+ ` dirs -v `
19
+
20
+ - Display the directory stack without the tilde-prefix (` ~ ` ):
21
+
22
+ ` dirs -l `
23
+
24
+ - Display only the ` n ` th entry in the directory stack, starting at 0 (Bash only):
16
25
17
26
` dirs +{{n}} `
18
27
28
+ - Display only the ` n ` th entry in the directory stack from the last, starting at 0 (Bash only):
29
+
30
+ ` dirs -{{n}} `
31
+
19
32
- Clear the directory stack:
20
33
21
34
` dirs -c `
Original file line number Diff line number Diff line change 1
1
# disown
2
2
3
3
> Allow sub-processes to live beyond the shell that they are attached to.
4
- > See also the ` jobs ` command .
4
+ > See also: ` jobs ` for finding job numbers .
5
5
> More information: < https://www.gnu.org/software/bash/manual/bash.html#index-disown > .
6
6
7
7
- Disown the current job:
8
8
9
9
` disown `
10
10
11
- - Disown a specific job:
11
+ - Disown a specific job (run ` jobs ` to find the job number) :
12
12
13
13
` disown %{{job_number}} `
14
14
15
- - Disown all jobs:
15
+ - Disown all jobs (Bash only) :
16
16
17
17
` disown -a `
18
18
19
- - Keep job (do not disown it), but mark it so that no future SIGHUP is received on shell exit:
19
+ - Keep job (do not disown it), but mark it so that no future SIGHUP is received on shell exit (Bash only) :
20
20
21
21
` disown -h %{{job_number}} `
Original file line number Diff line number Diff line change 1
1
# echo
2
2
3
3
> Print given arguments.
4
+ > See also: ` printf ` .
4
5
> More information: < https://www.gnu.org/software/coreutils/manual/html_node/echo-invocation.html > .
5
6
6
7
- Print a text message. Note: Quotes are optional:
Original file line number Diff line number Diff line change 1
1
# fg
2
2
3
3
> Run jobs in foreground.
4
+ > See also: ` jobs ` , ` bg ` and ` disown ` .
4
5
> More information: < https://manned.org/fg > .
5
6
6
7
- Bring most recently suspended or running background job to foreground:
7
8
8
9
` fg `
9
10
10
- - Bring a specific job to foreground:
11
+ - Bring a specific job to foreground (run ` jobs ` to find the job number) :
11
12
12
- ` fg %{{job_id }} `
13
+ ` fg %{{job_number }} `
Original file line number Diff line number Diff line change 1
1
# local
2
2
3
3
> Declare local variables and give them attributes.
4
- > See also: ` declare ` .
4
+ > See also: ` declare ` and ` export ` .
5
5
> More information: < https://www.gnu.org/software/bash/manual/bash.html#index-local > .
6
6
7
7
- Declare a string variable with the specified value:
Original file line number Diff line number Diff line change 1
1
# popd
2
2
3
3
> Remove a directory placed on the directory stack via the pushd shell built-in.
4
- > See also ` pushd ` to place a directory on the stack and ` dirs ` to display directory stack contents.
4
+ > See also: ` pushd ` to place a directory on the stack and ` dirs ` to display directory stack contents.
5
5
> More information: < https://www.gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html#index-popd > .
6
6
7
7
- Remove the top directory from the stack and cd to it:
Original file line number Diff line number Diff line change 1
1
# printf
2
2
3
3
> Format and print text.
4
+ > See also: ` echo ` .
4
5
> More information: < https://www.gnu.org/software/coreutils/manual/html_node/printf-invocation.html > .
5
6
6
7
- Print a text message:
Original file line number Diff line number Diff line change 1
1
# pushd
2
2
3
3
> Place a directory on a stack so it can be accessed later.
4
- > See also ` popd ` to switch back to original directory and ` dirs ` to display directory stack contents.
4
+ > See also: ` popd ` to switch back to original directory and ` dirs ` to display directory stack contents.
5
5
> More information: < https://www.gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html#index-pushd > .
6
6
7
7
- Switch to directory and push it on the stack:
Original file line number Diff line number Diff line change 23
23
- If A is true, then do B, or C in the case of an error (notice that C may run even if A fails):
24
24
25
25
` test {{condition}} && {{echo "true"}} || {{echo "false"}} `
26
+
27
+ - Use ` test ` in a conditional statement:
28
+
29
+ ` if test -f "{{path/to/file}}"; then echo "File exists"; else echo "File does not exist"; fi `
Original file line number Diff line number Diff line change 1
1
# unalias
2
2
3
3
> Remove aliases.
4
+ > See also: ` alias ` .
4
5
> More information: < https://manned.org/unalias > .
5
6
6
7
- Remove an alias:
Original file line number Diff line number Diff line change 1
1
# wait
2
2
3
3
> Wait for a process to complete before proceeding.
4
+ > See also: ` ps ` to view information about running processes.
4
5
> More information: < https://manned.org/wait > .
5
6
6
7
- Wait for a process to finish given its process ID (PID) and return its exit status:
11
12
12
13
` wait `
13
14
14
- - Wait for a job to finish:
15
+ - Wait for a job to finish (run ` jobs ` to find the job number) :
15
16
16
17
` wait %{{job_number}} `
17
18
You can’t perform that action at this time.
0 commit comments