DEV Community

drmikecrowe
drmikecrowe

Posted on

5 3

What bash aliases can't you live without?

Here's some of mine:

Change up 1, 2 or 3 directories:

alias .....='cd ../../../..'
alias ....='cd ../../..'
alias ...='cd ../..'
alias ..='cd ..
Enter fullscreen mode Exit fullscreen mode

Example:

mcrowe in /tmp/level-1/level-2/level-3/level-4/level-5 
$ ....
mcrowe in /tmp/level-1/level-2 
$ 
Enter fullscreen mode Exit fullscreen mode

Grep history:

alias gh='history | grep --colour=auto'
Enter fullscreen mode Exit fullscreen mode

Strip line numbers from history "history cut"

alias hc="history | cut -b 8-
Enter fullscreen mode Exit fullscreen mode

ps commands:

alias psa='ps faux'
alias psag='ps faux | grep
Enter fullscreen mode Exit fullscreen mode

psa: shows detailed output:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         2  0.0  0.0      0     0 ?        S    Jan15   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        I<   Jan15   0:00  \_ [rcu_gp]
root         4  0.0  0.0      0     0 ?        I<   Jan15   0:00  \_ [rcu_par_gp]
Enter fullscreen mode Exit fullscreen mode

psag: Grep psa output:

$ psag nemo
mcrowe   15096  0.0  1.8 1095252 454104 tty2   Sl+  Jan16   3:12              |       \_ nemo
mcrowe   26147  0.0  0.0  17532   868 pts/1    S+   11:19   0:00              |       |               \_ grep --color --exclude-dir=.svn --exclude-dir=.git nemo
mcrowe    2366  0.0  0.1 822992 42108 tty2     Sl+  Jan15   0:17              \_ nemo-desktop
Enter fullscreen mode Exit fullscreen mode

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (1)

Collapse
 
osde8info profile image
Clive Da

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay