Helpful user-created aliases

CrazedNerd

Gold Member
Gold Supporter
Joined
Mar 31, 2021
Messages
608
Reaction score
242
Credits
5,135
Do any of you care much for making aliases? Making an alias is very similar to making a script, however, you don't need to have a separate file for each one. Most of mine center around the ls command, which is arguably the most useful command in linux. Here is my .bash_aliases file:

Code:
#'=' must not be surrounded by whitespace for these to work"
alias ls='ls -1v --color=auto -hAF'
#-1v sorts numbered files lowest-highest, h shows hidden, A conceals"
#. and .., -F color codes file types"
#aliases below do not work without this

#hidden files
alias lsh='ls -d .* | grep -v /'

#files (no directory)"
alias lsf='ls | grep -v /'

#only directories, hidden included"
alias lsd='ls -d */ .*/'


#only hidden directories
alias lsdh='ls -d .* | grep -v *.txt'

#displays most recently modified files at top
alias lst='ls -t'

alias grep='grep -i'

#automatically ignores case

alias nano='nano -c'

#show cursor, column (by char), line stats at bottom of page in nano

alias lexe='ls | grep "*"'

#shows files with execute permissions enabled for scripts etc.

alias lsl='ls -l'

#highly detailed ls

alias work='. .bash_aliases; . .bashrc'

#make changes to bash effective immediately
 


KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
6,767
Reaction score
5,904
Credits
54,530
I use aliases all the time. Here's a fun one:

Code:
alias picclean="exiftool -overwrite_original -all= *.png ; exiftool -overwrite_original -all= *.jpg ; echo $PWD 'images cleaned for privacy sake!'"
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top