Skip to content

Commit

Permalink
updated bash.md
Browse files Browse the repository at this point in the history
  • Loading branch information
HariSekhon committed Jul 11, 2024
1 parent b9ec1fd commit dba66e3
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,42 +70,42 @@ You also need to learn [Regex](regex.md) to use these tools effectively.

Some less well known commands to remember:

| Command | Description |
|---------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `cmp` | compare whether two files diff. Shorter than doing an `md5sum` on both (`md5` on Mac) |
| `comm` | print or omit lines are common or unique between two files |
| `expand` | expands tabs to spaces |
| `unexpand` | converts spaces to tabs |
| `fmt` | |
| `join` | join matching records from multiple files |
| `logger` | sends messages to the system log ie. syslog `/var/log/messages` |
| `mail` | send email from the command line |
| `whatis`/ `proppos` / `man -k` | search for man pages containing the argument string |
| `command` | execute a binary from the path instead of a function of the same name |
| `builtin` | execute a shell builtin instead of a function of the same name |
| `dialog` | create an interactive curses menu |
| `say` | Mac command that speaks the words piped in. I use this to impress my kids by making the computers talk |
| `type` | Tells you what a command is, path to binary or shell builtin. `-P` returns only <br/>binary |
| `xev` | Prints the keystrokes to the Linux X server GUI |
| `tail --follow=name --retry <filename>` | GNU tail can retry and continue following a file if it's renamed |
| `split` | Split a text file into smaller parts by lines or bytes. Useful for parallel data processing |
| `csplit` | Split with context by splitting on pattern such as regex |
| `pr -m` | Prints files into columns |
| `column -t` | Prints stdin into aligned columns to tidy up output (used in various scripts in [DevOps-Bash-tools](https://github.com/HariSekhon/DevOps-Bash-tools) |
| `paste` | merges text files to stdout |
| `open` | Mac command to open a URL in the default web browser |
| `xmessage` | Linux X GUI pop-up message command |
| `xclip` | Copy stdin to the Linux X UI clipboard, or the clipboard to stdout |
| `pbcopy` | Copy stdin to the Mac UI clipboard |
| `pbpaste` | Prints the Mac UI clipboard to stdout |
| `gprof` | Profile output of an executable's time in each system call. Compile with `gcc -pg` first |
| `expect` | Controls interactive programs by sending them timed input from an 'expect' script |
| `autoexpect` | Generate an `expect` script automatically from an interactive run |
| `flock` | File lock, useful for advanced scripting. I'd previously written [flock.<br/>pl](https://github.com/HariSekhon/DevOps-Perl-tools/blob/master/flock.pl) to allow shell scripts to using programming file locking |
| `script` | Copy everything you write in the shell to a file to record an outline of a script for you |
| `tee` | Pipes output to one or more file arguments as well as stdout for further piping. The `-a` switch appends instead of overwrites the file |
| `fold` | Wraps text to the width specified by `-w N`. Use `-s` to only fold on spaces, not mid-word |
| `pandoc` | Universal document converter<br/>(eg. [generate_repos_markdown_table.sh](https://github.com/HariSekhon/Kubernetes-configs/blob/master/generate_repos_markdown_table.sh)) |
| Command | Description |
|---------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `cmp` | compare whether two files diff. Shorter than doing an `md5sum` on both (`md5` on Mac) |
| `comm` | print or omit lines are common or unique between two files |
| `expand` | expands tabs to spaces |
| `unexpand` | converts spaces to tabs |
| `fmt` | |
| `join` | join matching records from multiple files |
| `logger` | sends messages to the system log ie. syslog `/var/log/messages` |
| `mail` | send email from the command line |
| `whatis`/ `proppos` / `man -k` | search for man pages containing the argument string |
| `command` | execute a binary from the path instead of a function of the same name |
| `builtin` | execute a shell builtin instead of a function of the same name |
| `dialog` | create an interactive curses menu |
| `say` | Mac command that speaks the words piped in. I use this to impress my kids by making the computers talk |
| `type` | Tells you what a command is, path to binary or shell builtin. `-P` returns only binary |
| `xev` | Prints the keystrokes to the Linux X server GUI |
| `tail --follow=name --retry <filename>` | GNU tail can retry and continue following a file if it's renamed |
| `split` | Split a text file into smaller parts by lines or bytes. Useful for parallel data processing |
| `csplit` | Split with context by splitting on pattern such as regex |
| `pr -m` | Prints files into columns |
| `column -t` | Prints stdin into aligned columns to tidy up output (used in various scripts in [DevOps-Bash-tools](https://github.com/HariSekhon/DevOps-Bash-tools) |
| `paste` | merges text files to stdout |
| `open` | Mac command to open a URL in the default web browser |
| `xmessage` | Linux X GUI pop-up message command |
| `xclip` | Copy stdin to the Linux X UI clipboard, or the clipboard to stdout |
| `pbcopy` | Copy stdin to the Mac UI clipboard |
| `pbpaste` | Prints the Mac UI clipboard to stdout |
| `gprof` | Profile output of an executable's time in each system call. Compile with `gcc -pg` first |
| `expect` | Controls interactive programs by sending them timed input from an 'expect' script |
| `autoexpect` | Generate an `expect` script automatically from an interactive run |
| `flock` | File lock, useful for advanced scripting. I'd previously written [flock.pl](https://github.com/HariSekhon/DevOps-Perl-tools/blob/master/flock.pl) to allow shell scripts to using programming file locking |
| `script` | Copy everything you write in the shell to a file to record an outline of a script for you |
| `tee` | Pipes output to one or more file arguments as well as stdout for further piping. The `-a` switch appends instead of overwrites the file |
| `fold` | Wraps text to the width specified by `-w N`. Use `-s` to only fold on spaces, not mid-word |
| `pandoc` | Universal document converter<br/>(eg. [generate_repos_markdown_table.sh](https://github.com/HariSekhon/Kubernetes-configs/blob/master/generate_repos_markdown_table.sh)) |

Environment variables to keep in mind:

Expand Down

0 comments on commit dba66e3

Please sign in to comment.