Good idea for an alias.
Show me your aliases and i'll show you mine ;-)
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
Re: Show me your aliases and i'll show you mine ;-)
I'm also Terminalforlife on GitHub.
Re: Show me your aliases and i'll show you mine ;-)
I have no aliases. As the bash man page says, "For almost every purpose, aliases are superseded by shell functions."
Chris F.A. Johnson
-
- Level 1
- Posts: 18
- Joined: Sat Nov 13, 2021 6:02 pm
Re: Show me your aliases and i'll show you mine ;-)
Code: Select all
alias m4a='cd Downloads; for f in *m4a; do ffmpeg -i "$f" -vn "$f".mp3;rm "$f";done;cd
alias batvol='cd Downloads; mkdir -p louder; for f in *.mp3; do ffmpeg -i "$f" -filter:a "volume=3.5" "louder/$f";rm "$f"; done;cd ~
alias mp3='cd Downloads/louder; for f in *.mp3 ;do mv "$f" /media/daryl/"Clip Sport"/Podcasts ;done; cd ~'
[.code]
-
- Level 3
- Posts: 118
- Joined: Fri Jan 21, 2022 2:29 pm
Re: Show me your aliases and i'll show you mine ;-)
Linux was designed to be efficient, which is why we have terse/short commands; typing 3 letters is better than 10. Aliases are great at facilitating that functionality.
I think it's great for adding things like --color=auto, that we wouldn't want to type every time, but that grant much usability.
As mentioned, and as was my first thought, they can cause you to forget the actual commands and parameters, so we must be careful. But, we have a backup in case we're on a foreign machine ... man. So all is not lost.
I tend to disagree with the way they aliased ll,la,l separately in our .bashrc files. That's getting too superfluous and clogged, IMO. What if you installed a utility executed as ll or la or l? You'd 1: not have access to those commands until you removed the alias. 2: You'd have to unlearn the aliased version.
I think .bash_aliases is a superfluous file, and just adds another item to our home directory lists. It's not like it's hard to manage aliases in our .bashrc files.
I think it's great for adding things like --color=auto, that we wouldn't want to type every time, but that grant much usability.
As mentioned, and as was my first thought, they can cause you to forget the actual commands and parameters, so we must be careful. But, we have a backup in case we're on a foreign machine ... man. So all is not lost.
I tend to disagree with the way they aliased ll,la,l separately in our .bashrc files. That's getting too superfluous and clogged, IMO. What if you installed a utility executed as ll or la or l? You'd 1: not have access to those commands until you removed the alias. 2: You'd have to unlearn the aliased version.
I think .bash_aliases is a superfluous file, and just adds another item to our home directory lists. It's not like it's hard to manage aliases in our .bashrc files.
Re: Show me your aliases and i'll show you mine ;-)
I find it very useful to keep these things separate. My BASH configuration files aren't especially short and simple, so that would make for a rather large file if I slammed them all together.AwesomeOpossum74 wrote: ⤴Tue Jan 25, 2022 1:07 pm I think .bash_aliases is a superfluous file, and just adds another item to our home directory lists. It's not like it's hard to manage aliases in our .bashrc files.
My '.bashrc' is 169 lines long, my '.bash_functions' file is 474 lines long. I no longer use '.bash_aliases', because I converted all of my aliases to functions a while ago. I just prefer having them separate, plus it means I can easily source one without the other(s). For a simpler/smaller configuration, I'd certainly agree with you, however. I actually removed a lot of functions/aliases from my configuration, so there used to be quite a bit more.
I'm also Terminalforlife on GitHub.
-
- Level 3
- Posts: 158
- Joined: Thu Jan 13, 2022 8:42 am
Re: Show me your aliases and i'll show you mine ;-)
I quite agree. I have even a 3rd file besides aliases (small) and functions (large) which is a file with constant values containing for example color and attributes for tput and echo (more easy to remember TRedfg or ERedfg than tputsetaf1 or '\033[0;30m' or dir variables like FFDir which points to the Firefox directory so that if one day Mozilla changes its dir location or if I have to install a flatpak, I'll just have to change this constant to let all my FF scripts work fine again. This file adds custom variables to the system environment and I'm using a first-letter-upcase naming in order to avoid collisions with system variables using only uppercase and shell commands always using lowercase.
Interests : Firefox, Cinnamon & Bash Scripts
LM Version : LMDE5 (LMDE4 just in case)
LM Version : LMDE5 (LMDE4 just in case)
Re: Show me your aliases and i'll show you mine ;-)
Sounds interesting. Do you have your configurations on GitHub at all? I'd like to check them out.
I'm also Terminalforlife on GitHub.
- Lady Fitzgerald
- Level 15
- Posts: 5820
- Joined: Tue Jan 07, 2020 3:12 pm
- Location: AZ, SSA (Squabbling States of America)
Re: Show me your aliases and i'll show you mine ;-)
Then you have people like me who either can't remember the commands in the first place or can't type them out without typos.AwesomeOpossum74 wrote: ⤴Tue Jan 25, 2022 1:07 pm ...As mentioned, and as was my first thought, they can cause you to forget the actual commands and parameters, so we must be careful...
Jeannie
To ensure the safety of your data, you have to be proactive, not reactive, so, back it up!
To ensure the safety of your data, you have to be proactive, not reactive, so, back it up!
Re: Show me your aliases and i'll show you mine ;-)
I suppose that's one of the reasons why we have GUIs.Lady Fitzgerald wrote: ⤴Tue Jan 25, 2022 8:31 pm Then you have people like me who either can't remember the commands in the first place or can't type them out without typos.
I'm also Terminalforlife on GitHub.
- Lady Fitzgerald
- Level 15
- Posts: 5820
- Joined: Tue Jan 07, 2020 3:12 pm
- Location: AZ, SSA (Squabbling States of America)
Re: Show me your aliases and i'll show you mine ;-)
Prexactly!Termy wrote: ⤴Wed Jan 26, 2022 11:32 amI suppose that's one of the reasons why we have GUIs.Lady Fitzgerald wrote: ⤴Tue Jan 25, 2022 8:31 pm Then you have people like me who either can't remember the commands in the first place or can't type them out without typos.
Jeannie
To ensure the safety of your data, you have to be proactive, not reactive, so, back it up!
To ensure the safety of your data, you have to be proactive, not reactive, so, back it up!
Re: Show me your aliases and i'll show you mine ;-)
I always like using the -h option for human-readable output when the commands support it. Here are some of my favourite aliases:
Code: Select all
alias ll='ls -lh'
alias du='du -h'
alias df='df -h'
alias free='free -h'
Re: Show me your aliases and i'll show you mine ;-)
Fun fact, regarding human-readable format: you can use numfmt(1) to convert raw numbers to a human-readable size. There are some caveats, but in the right situation, it's awesome. I got that tip from xenopeek a while back on this board, IIRC. Here's an example, showing the total RAM found on the system, using the
--from-unit
flag to specify that it starts at Kibibyte:Code: Select all
awk '$1 == "MemTotal:" {print($2)}' /proc/meminfo | numfmt --from-unit=K --to=iec
Code: Select all
du -h --max-depth=1 "$HOME" | sort -rhk 1 | sed -r "1d; s/^(.+\t+)\/home\/$USER(\/.*)\$/\1~\2/" | column
I'm also Terminalforlife on GitHub.
- AZgl1800
- Level 20
- Posts: 11184
- Joined: Thu Dec 31, 2015 3:20 am
- Location: Oklahoma where the wind comes Sweeping down the Plains
- Contact:
Re: Show me your aliases and i'll show you mine ;-)
me?
fun one.
OkieNotFromMuskogee
fun one.
OkieNotFromMuskogee
Re: Show me your aliases and i'll show you mine ;-)
Old habits..
Code: Select all
alias cd..='cd ..'
alias cls='echo -en "\033c"'
-
- Level 3
- Posts: 158
- Joined: Thu Jan 13, 2022 8:42 am
Re: Show me your aliases and i'll show you mine ;-)
Is the clear command not doing the same job ?
Interests : Firefox, Cinnamon & Bash Scripts
LM Version : LMDE5 (LMDE4 just in case)
LM Version : LMDE5 (LMDE4 just in case)
Re: Show me your aliases and i'll show you mine ;-)
clear(1) is part of NCurses; specifically, the 'ncurses-bin' package, which may not have been around back in the day, hence "old habits". Nowadays, yes, clear(1) and
tput clear
should more than suffice. In scripts, it might be quite nice to use the escape sequence, because it's more efficient, but it's not nearly as portable, if you assume all systems have tput(1) or clear(1).I'm also Terminalforlife on GitHub.
Re: Show me your aliases and i'll show you mine ;-)
I like to have these aliases
Code: Select all
alias llt='ls -ltrh'
alias lla='ls -la'
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../'
alias h='history'
Last edited by SMG on Mon May 02, 2022 7:47 pm, edited 1 time in total.
Reason: Removed signature to comply with forum rules.
Reason: Removed signature to comply with forum rules.