Useful UNIX commands
This is my list of less known but great UNIX command I use daily.
It’s mostly focused on development rather than sysadmin.
ag
Super fast code search (grep
on steroids).
$ ag ster
_posts/2016-11-11-useful-commands.md
73:Super fast code search (`grep` on steroids).
It will save you from the end of the world.
tree
Renders a folders and files hierarchy.
Example:
tree
$ tree
.
├── Gemfile
├── Gemfile.lock
├── LICENSE.md
├── README.md
├── Rakefile
├── _config.yml
├── _drafts
│ ├── from-linux-to-bsd.md
│ ├── react-redux-structure.md
│ └── using-normaliz-loki.md
├── _includes
│ ├── footer.html
│ ├── head.html
│ └── header.html
├── _layouts
│ ├── default.html
│ ├── page.html
│ └── post.html
...
On macOS, you can install it with hombrew.
direnv
Allows to have a local environment.
For example, if you put:
export MY_SECRET=hello
in a .envrc
file, as soon as you cd <folder_containing_envrc>
MY_SECRET
will be defined to hello .
Super handy to manage app secrets.
pstree
Will display a tree of processes.
pstree -g 3 -w | less
Under FreeBSD, ps
has a built in similar functionality:
ps -auxd | less
Piping into less is of course optional, but less is more.