From 8bc9dce9b1aa5259f2bbec0d522a9b335ed3eeb0 Mon Sep 17 00:00:00 2001 From: Pranaov S <148376495+pranaovs@users.noreply.github.com> Date: Sat, 14 Jun 2025 16:02:15 +0000 Subject: [PATCH] pages/common/*: correct urls, see also improvements, unbashify pages, examples addition (#16841) Co-authored-by: Managor <42655600+Managor@users.noreply.github.com> Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com> --- pages/common/alias.md | 5 +++-- pages/common/bg.md | 5 +++-- pages/common/command.md | 4 ++++ pages/common/dirs.md | 15 ++++++++++++++- pages/common/disown.md | 8 ++++---- pages/common/echo.md | 1 + pages/common/fg.md | 5 +++-- pages/common/local.md | 2 +- pages/common/popd.md | 2 +- pages/common/printf.md | 1 + pages/common/pushd.md | 2 +- pages/common/test.md | 4 ++++ pages/common/unalias.md | 1 + pages/common/wait.md | 3 ++- 14 files changed, 43 insertions(+), 15 deletions(-) diff --git a/pages/common/alias.md b/pages/common/alias.md index cf59fd154a..b47865f171 100644 --- a/pages/common/alias.md +++ b/pages/common/alias.md @@ -1,8 +1,9 @@ # alias > Create aliases - words that are replaced by a command string. -> Aliases expire with the current shell session unless defined in the shell's configuration file, e.g. `~/.bashrc`. -> More information: . +> Aliases expire with the current shell session unless defined in the shell's configuration file, e.g. `~/.bashrc` for Bash or `~/.zshrc` for Zsh. +> See also: `unalias`. +> More information: . - List all aliases: diff --git a/pages/common/bg.md b/pages/common/bg.md index 184437e637..6d94ca2be7 100644 --- a/pages/common/bg.md +++ b/pages/common/bg.md @@ -1,12 +1,13 @@ # bg > Resume suspended jobs (e.g. using ``), and keeps them running in the background. +> See also: `jobs`, `fg` and `disown`. > More information: . - 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: +- Resume a specific job and run it in the background (run `jobs` to find the job number): -`bg %{{job_id}}` +`bg %{{job_number}}` diff --git a/pages/common/command.md b/pages/common/command.md index 30f3817b59..2a20771656 100644 --- a/pages/common/command.md +++ b/pages/common/command.md @@ -7,6 +7,10 @@ `command {{ls}}` +- 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: + +`command -p {{command_name}}` + - Display the path to the executable or the alias definition of a specific command: `command -v {{command_name}}` diff --git a/pages/common/dirs.md b/pages/common/dirs.md index 3cad4e4b1c..a750d1b64a 100644 --- a/pages/common/dirs.md +++ b/pages/common/dirs.md @@ -2,6 +2,7 @@ > Display or manipulate the directory stack. > The directory stack is a list of recently visited directories that can be manipulated with the `pushd` and `popd` commands. +> See also: `pushd`, `popd`. > More information: . - Display the directory stack with a space between each entry: @@ -12,10 +13,22 @@ `dirs -p` -- Display only the `n`th entry in the directory stack, starting at 0: +- Display a numbered list of entries in the directory stack: + +`dirs -v` + +- Display the directory stack without the tilde-prefix (`~`): + +`dirs -l` + +- Display only the `n`th entry in the directory stack, starting at 0 (Bash only): `dirs +{{n}}` +- Display only the `n`th entry in the directory stack from the last, starting at 0 (Bash only): + +`dirs -{{n}}` + - Clear the directory stack: `dirs -c` diff --git a/pages/common/disown.md b/pages/common/disown.md index 75cc98d739..2ba6170309 100644 --- a/pages/common/disown.md +++ b/pages/common/disown.md @@ -1,21 +1,21 @@ # disown > Allow sub-processes to live beyond the shell that they are attached to. -> See also the `jobs` command. +> See also: `jobs` for finding job numbers. > More information: . - Disown the current job: `disown` -- Disown a specific job: +- Disown a specific job (run `jobs` to find the job number): `disown %{{job_number}}` -- Disown all jobs: +- Disown all jobs (Bash only): `disown -a` -- Keep job (do not disown it), but mark it so that no future SIGHUP is received on shell exit: +- Keep job (do not disown it), but mark it so that no future SIGHUP is received on shell exit (Bash only): `disown -h %{{job_number}}` diff --git a/pages/common/echo.md b/pages/common/echo.md index fd2cc6abcb..b630b2c0af 100644 --- a/pages/common/echo.md +++ b/pages/common/echo.md @@ -1,6 +1,7 @@ # echo > Print given arguments. +> See also: `printf`. > More information: . - Print a text message. Note: Quotes are optional: diff --git a/pages/common/fg.md b/pages/common/fg.md index f8d79fd1e0..79f69d34ae 100644 --- a/pages/common/fg.md +++ b/pages/common/fg.md @@ -1,12 +1,13 @@ # fg > Run jobs in foreground. +> See also: `jobs`, `bg` and `disown`. > More information: . - Bring most recently suspended or running background job to foreground: `fg` -- Bring a specific job to foreground: +- Bring a specific job to foreground (run `jobs` to find the job number): -`fg %{{job_id}}` +`fg %{{job_number}}` diff --git a/pages/common/local.md b/pages/common/local.md index 34a754e39e..2aefbc6b01 100644 --- a/pages/common/local.md +++ b/pages/common/local.md @@ -1,7 +1,7 @@ # local > Declare local variables and give them attributes. -> See also: `declare`. +> See also: `declare` and `export`. > More information: . - Declare a string variable with the specified value: diff --git a/pages/common/popd.md b/pages/common/popd.md index 7894d5df8a..22a8f76e0a 100644 --- a/pages/common/popd.md +++ b/pages/common/popd.md @@ -1,7 +1,7 @@ # popd > Remove a directory placed on the directory stack via the pushd shell built-in. -> See also `pushd` to place a directory on the stack and `dirs` to display directory stack contents. +> See also: `pushd` to place a directory on the stack and `dirs` to display directory stack contents. > More information: . - Remove the top directory from the stack and cd to it: diff --git a/pages/common/printf.md b/pages/common/printf.md index cf7313ab33..0fe9ebaa76 100644 --- a/pages/common/printf.md +++ b/pages/common/printf.md @@ -1,6 +1,7 @@ # printf > Format and print text. +> See also: `echo`. > More information: . - Print a text message: diff --git a/pages/common/pushd.md b/pages/common/pushd.md index 7a711da6b7..1216b37eae 100644 --- a/pages/common/pushd.md +++ b/pages/common/pushd.md @@ -1,7 +1,7 @@ # pushd > Place a directory on a stack so it can be accessed later. -> See also `popd` to switch back to original directory and `dirs` to display directory stack contents. +> See also: `popd` to switch back to original directory and `dirs` to display directory stack contents. > More information: . - Switch to directory and push it on the stack: diff --git a/pages/common/test.md b/pages/common/test.md index 69f92da7e5..506cb331b4 100644 --- a/pages/common/test.md +++ b/pages/common/test.md @@ -23,3 +23,7 @@ - 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"}}` + +- Use `test` in a conditional statement: + +`if test -f "{{path/to/file}}"; then echo "File exists"; else echo "File does not exist"; fi` diff --git a/pages/common/unalias.md b/pages/common/unalias.md index 8c23b65fd4..28f988d77f 100644 --- a/pages/common/unalias.md +++ b/pages/common/unalias.md @@ -1,6 +1,7 @@ # unalias > Remove aliases. +> See also: `alias`. > More information: . - Remove an alias: diff --git a/pages/common/wait.md b/pages/common/wait.md index c7905cb834..c21519de26 100644 --- a/pages/common/wait.md +++ b/pages/common/wait.md @@ -1,6 +1,7 @@ # wait > Wait for a process to complete before proceeding. +> See also: `ps` to view information about running processes. > More information: . - Wait for a process to finish given its process ID (PID) and return its exit status: @@ -11,7 +12,7 @@ `wait` -- Wait for a job to finish: +- Wait for a job to finish (run `jobs` to find the job number): `wait %{{job_number}}`