mirror of
https://github.com/xmengnet/the-art-of-command-line.git
synced 2024-12-24 23:56:29 +08:00
commit
3805acdd51
1 changed files with 7 additions and 7 deletions
14
README.md
14
README.md
|
@ -35,7 +35,7 @@ but it has since moved to GitHub, where people more talented than the original a
|
|||
Scope:
|
||||
|
||||
- This guide is both for beginners and the experienced. The goals are *breadth* (everything important), *specificity* (give concrete examples of the most common case), and *brevity* (avoid things that aren't essential or digressions you can easily look up elsewhere). Every tip is essential in some situation or significantly saves time over alternatives.
|
||||
- This is written for Linux, with the exception of the "[OS X only](#os-x-only)" section. Many of the other items apply or can be installed on other Unices or MacOS (or even Cygwin).
|
||||
- This is written for Linux, with the exception of the "[OS X only](#os-x-only)" section. Many of the other items apply or can be installed on other Unices or OS X (or even Cygwin).
|
||||
- The focus is on interactive Bash, though many tips apply to other shells and to general Bash scripting.
|
||||
- It includes both "standard" Unix commands as well as ones that require special package installs -- so long as they are important enough to merit inclusion.
|
||||
|
||||
|
@ -488,27 +488,27 @@ A few examples of piecing together commands:
|
|||
|
||||
## OS X only
|
||||
|
||||
These are items relevant *only* on MacOS.
|
||||
These are items relevant *only* on OS X.
|
||||
|
||||
- Package management with `brew` (Homebrew) and/or `port` (MacPorts). These can be used to install on MacOS many of the above commands.
|
||||
- Package management with `brew` (Homebrew) and/or `port` (MacPorts). These can be used to install on OS X many of the above commands.
|
||||
|
||||
- Copy output of any command to a desktop app with `pbcopy` and paste input from one with `pbpaste`.
|
||||
|
||||
- To enable the Option key in Mac OS Terminal as an alt key (such as used in the commands above like **alt-b**, **alt-f**, etc.), open Preferences -> Profiles -> Keyboard and select "Use Option as Meta key".
|
||||
- To enable the Option key in OS X Terminal as an alt key (such as used in the commands above like **alt-b**, **alt-f**, etc.), open Preferences -> Profiles -> Keyboard and select "Use Option as Meta key".
|
||||
|
||||
- To open a file with a desktop app, use `open` or `open -a /Applications/Whatever.app`.
|
||||
|
||||
- Spotlight: Search files with `mdfind` and list metadata (such as photo EXIF info) with `mdls`.
|
||||
|
||||
- Be aware MacOS is based on BSD Unix, and many commands (for example `ps`, `ls`, `tail`, `awk`, `sed`) have many subtle variations from Linux, which is largely influenced by System V-style Unix and GNU tools. You can often tell the difference by noting a man page has the heading "BSD General Commands Manual." In some cases GNU versions can be installed, too (such as `gawk` and `gsed` for GNU awk and sed). If writing cross-platform Bash scripts, avoid such commands (for example, consider Python or `perl`) or test carefully.
|
||||
- Be aware OS X is based on BSD Unix, and many commands (for example `ps`, `ls`, `tail`, `awk`, `sed`) have many subtle variations from Linux, which is largely influenced by System V-style Unix and GNU tools. You can often tell the difference by noting a man page has the heading "BSD General Commands Manual." In some cases GNU versions can be installed, too (such as `gawk` and `gsed` for GNU awk and sed). If writing cross-platform Bash scripts, avoid such commands (for example, consider Python or `perl`) or test carefully.
|
||||
|
||||
- To get MacOS release information, use `sw_vers`.
|
||||
- To get OS X release information, use `sw_vers`.
|
||||
|
||||
|
||||
## More resources
|
||||
|
||||
- [awesome-shell](https://github.com/alebcay/awesome-shell): A curated list of shell tools and resources.
|
||||
- [awesome-osx-command-line](https://github.com/herrbischoff/awesome-osx-command-line): A more in-depth guide for the Mac OS command line.
|
||||
- [awesome-osx-command-line](https://github.com/herrbischoff/awesome-osx-command-line): A more in-depth guide for the OS X command line.
|
||||
- [Strict mode](http://redsymbol.net/articles/unofficial-bash-strict-mode/) for writing better shell scripts.
|
||||
- [shellcheck](https://github.com/koalaman/shellcheck): A shell script static analysis tool. Essentially, lint for bash/sh/zsh.
|
||||
- [Filenames and Pathnames in Shell](http://www.dwheeler.com/essays/filenames-in-shell.html): The sadly complex minutiae on how to handle filenames correctly in shell scripts.
|
||||
|
|
Loading…
Reference in a new issue