What's your most-used terminal alias or function?

We all have that one alias or shell function we’ve quietly copy-pasted into every new machine for years. The little quality-of-life trick that makes you irrationally happy every time it saves you three keystrokes.

Drop your favorite alias, one-liner, or shell function below and tell us what it does, bonus points if it’s something you cooked up yourself and didn’t just steal from a dotfiles repo (we won’t judge if you did though). :slight_smile:

2 Likes
alias ls="lsd -lah --header"
2 Likes
alias ll="ls -lAhF --group-directories-first"

Nothing groundbreaking but having directories sorted to the top and hidden files visible by default just makes navigating so much smoother. I tried switching to eza at one point but honestly kept coming back to this.

4 Likes

Here are my favorites ones:
alias update=“sudo apt update && sudo apt upgrade”

alias ls=“ls -alF”

1 Like

believe it or not c is one of my most common alias commands.
alias c=‘clear;pwd’
I have various ls aliases that are also very frequently used, on Endeavour OS where I happen to be at the moment, here’s how I implemented them on this system.
alias l=‘ls -al’
alias ll=‘ls -l’

I vary those, depending on what I’m doing.
alias u is another VERY common alias that I use; again I alter this one depending on which distribution I’m using. On antiX, I use it with apt commands; here on Endeavour OS, the following:
alias u=‘yay -Syu’

3 Likes

alias cls=clear
alias ltr=‘ls -latr’
alias hello=‘cd; clear; fastfetch’
update=‘apt clean all; apt update; apt -y upgrade’

2 Likes

i have many alias for my favorite directorys like

vm
dock
data
dev
learn

alias ..=‘cd ..’
alias …=‘cd ../..’
alias …=‘cd ../../..’
alias home=‘cd ~’
alias root=‘cd /’
alias logs=‘cd /var/log’
alias topu=‘top -u $USER’
alias psa=‘ps aux’

5 Likes

@Blue_bird I love your alias commands. I may add a few of them to my collection.

3 Likes

Indeed, these are great guys. Thanks for sharing.

Will be referencing you guys in an article tomorrow:

From the Community

The LinuxCommunity.io forum thread on favorite aliases and functions collected some solid contributions worth adding to your own setup. Here are the highlights.

toadie swaps ls for lsd, a modern ls replacement with icons and color output:

alias ls="lsd -lah --header"

toadie also uses short named aliases for frequently visited directories, one per project or location:

alias vm='cd ~/vm' 
alias dock='cd ~/docker' 
alias dev='cd ~/dev' 
alias learn='cd ~/learn'

Once you have more than a handful of project directories, this pattern beats cd-ing through long paths every time.

I used a version of ll that sorts directories to the top:

alias ll="ls -lAhF --group-directories-first"

Small change from the standard ll, but having directories sorted above files makes scanning large directories noticeably faster.

Gopinath Pigili adds a few location shortcuts and a per-user top view:

alias home='cd ~' 
alias root='cd /' 
alias logs='cd /var/log' 
alias topu='top -u $USER' 
alias psa='ps aux'

topu is a neat one. It filters top to show only your own processes, useful on shared systems where other users’ processes clutter the output.

Brian Masinick keeps a simple c alias that clears the screen and prints the current directory in one shot:

alias c='clear;pwd'

He also uses a short u alias mapped to the update command for whichever distro he’s on at the time, swapping it out per machine. Same principle as the distro-specific update aliases covered above, just taken further.

J J Sloan has a hello alias that makes for a satisfying login sequence:

alias cls=clear 
alias ltr='ls -latr' 
alias hello='cd; clear; fastfetch'`

hello drops you to home, clears the screen, and fires fastfetch for a system info summary. Good for a fresh terminal orientation. ltr sorts files by modification time with the most recently changed at the bottom, useful when you want to see what changed and when.

2 Likes