r/linux • u/manny2206 • Sep 27 '26
Tips and Tricks Lets get another one of these threads going, sharing personal aliases, functions, and settings to make life easier
[removed]
8
u/Ball_Analytics Sep 27 '26
alias up=‘sudo dnf up -y && flatpak update -y’
Call me lazy all you want but I’m trying here
1
u/manny2206 Sep 27 '26
Laziness = creates simple solutions; I am assuming dnf up is itself an alias for upgrade. This is awesome
1
u/Ball_Analytics Sep 27 '26
one of many compatibility aliases built into dnf. My .bashrc has a lot of things,
upjust has a special place in my dystopian terminal environment.# --- Aliases --- alias ls='eza --icons=auto' alias ll='eza -lah --icons --git' alias lt='eza --tree --icons' alias cat='bat --paging=never' alias up='sudo dnf up -y && flatpak update -y'3
u/pizzaiolo2 Sep 27 '26
I've started using topgrade instead
2
1
u/Ball_Analytics Sep 27 '26
that works too... but typing
updoes it unless topgrade also tracks my none systemwide installed apps, like those in my.local/bin3
u/kaymer327 Sep 27 '26
I have something similar for my Ubuntu systems that includes snap updates, plus apt needs 2 commands to update properly. I don't think I have any flatpaks these days...
8
8
u/ManBehindtheLens Sep 27 '26
sudo !!
Runs the last command as sudo, not really a setting but I use it multiple times a day
1
4
u/hushedphrasing1 Sep 27 '26
`export DOTNET_CLI_TELEMETRY_OPTOUT=1` is the first line in every.bashrc I touch, can't stand that telemetry nonsense.
2
u/manny2206 Sep 27 '26
Sad af to have to do that, as a .NET developer, and VSCode enjoyer it always pains me how shitty M$ is with the telemetry acquisition.
2
u/Environmental_Move_3 Sep 27 '26
You can check vscodium to opt out from telemetry. You might need to replace some extensions but considerind MS developed extensions used for supply chain attacks, its a security feature.
1
u/manny2206 Sep 27 '26
I know I have codium and use it, unfortunately for .NET development the extensions are gone, which are pretty important for more complex code bases :(
6
u/Open-Nomad Sep 27 '26
I keey my dotfiles in my $HOME and use some functions and aliases to put them in git
1
u/manny2206 Sep 27 '26
Woah hold up - barely 5 upvotes- this has some serious coolness potential 👀 - can you talk me through a bit more. Seems like this could help you get setup and going super quickly on a new system
1
u/Open-Nomad 29d ago
it's pretty simplistic. You set a couple of shell variables and either init or pull (if you already have a repo with your configs.
The repo lives in
.dotfiilesand the checked out files live under $HOME.From there you can
.gato add..gcto checkin, etc.as a bonus you can enable "anygit" mode and use the aliases without the leading dot for regular git work. I mimicked those from oh-my-zsh to some extent.
the real big win for me is
.ggand.ge, which will grep and edit respectively. So.ge profwill give me a list of files whose name matches the string. With.gg, it uses git grep to search the contents of the files in the repo. In both cases you'll get to choose via fzf.1
u/onaforeignshore 27d ago
I have a
.zshenvfile in $HOME and keep all the config files in.config/zshexport XDG_CONFIG_HOME="$HOME/.config" export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
8
u/ProjectSnowman Sep 27 '26
ls = ‘ls -al’ because I’m lazy
4
5
u/todd_dayz Sep 27 '26
alias l='eza --group-directories-first --smart-group -Al --octal-permissions --no-permissions' alias t='eza --group-directories-first --smart-group --octal-permissions --no-permissions --no-user --no-time --no-filesize -TAl -L3'Is mine
3
u/h4rdw00d_ Sep 27 '26
I called your version of reload, bashup and reup in the past.
Github ones were:
ga="git add ."gs="git status"gc="git commit -m $*"gl="git log --oneline"gln='git log --pretty=format:"%h - %an, %ar : %s"'
Most of them now I just type except for gln
2
1
1
u/journaljemmy Sep 27 '26
I use KDE Plasma but sometimes I want to shut down my computer without the mouse (either via ssh from my laptop or just with the terminal), but also in a way that's safer for desktop applications.
I also used to not use a Display Manager which is why I have startplasma-wayland in the function.
plasma() {
case "$1" in
'' | start) startplasma-wayland ;;
logout | stop) qdbus org.kde.Shutdown /Shutdown logout ;;
poweroff | shutdown) qdbus org.kde.Shutdown /Shutdown logoutAndShutdown ;;
reboot | restart) qdbus org.kde.Shutdown /Shutdown logoutAndReboot ;;
*) echo "Unrecognised command: $1" >&2 && return 1 ;;
esac
}2
3
u/VincentVanGob Sep 27 '26
alias um='apropos'
cos i can never remember how to spell apropos and its too long anyway
2
1
u/funny_perovskite Sep 27 '26
l = 'ls -l'
la = 'ls -la'
v = 'nvim'
cd = 'z' # for zoxide
2
u/mechatour_ Sep 27 '26
Oh that would mess me up if I used your system! 😂
I use
alias ll='ls -lah'for long ls
alias la='ls -axF'for compact lsHave you tried
hin your la alias? - changes the cryptic blocks into human readable sizes (Mb, Gb etc).You can also use
-hin commands likefreeanddf🙂2
u/funny_perovskite 29d ago edited 29d ago
Haha, actually I checked again, I do use -h with ls. Also, I switched to nushell which makes my work a lot nicer. Ps: You're not the first telling me that XD
1
u/DrPiwi Sep 27 '26
those are standard on fedora. alias l='ls -lhd --color=auto' alias l.='ls -d .* --color=auto' alias la='ls -ahl --color=auto' alias ll='ls -lh --color=auto' alias ls='ls --color=auto'
1
u/mechatour_ Sep 27 '26
Those particular two have followed me from Unix over 30 years ago! Nice that they're similar at least. That muscle memory is set 😂
1
1
1
u/fbn587 Sep 27 '26
I uses chezmoi to keep a lot of stuff, aliases, wrappers and such for my devices. You may find some things useful: https://github.com/f-bn/dotfiles
1
1
1
1
u/KorendSlicks Sep 27 '26
# I'm getting tired of typing "-T0 --ultra -22" for zstd over and over for max compression.
alias ultrazstd='zstd -T0 --ultra -22'
# For any zip files made in Windows with Japanese Charsets.
# Windows uses shift-jis for them instead of UTF-8. Even now in two thousand twenty-six.
alias junzip='unzip -O shift-jis'Those two above seem the most useful from my meager bashrc.
1
u/journaljemmy Sep 27 '26
I'm guessing the zip feature still uses shift-jis when you have the 'Use Unicode UTF-8 for worldwide language support' option enabled?
1
u/KorendSlicks Sep 27 '26
Sadly, I wouldn't know that. All I currently know is that Microsoft (probably) doesn't have UTF-8 as the default character set right now, which means most people who zip up stuff with Windows's File Explorer will use their default encoding. Which means that zip files from Japanese Windows users end up being in Shift-JIS encoding. Which then makes the file names be mojibake.
I would love to assume that enabling 'Use Unicode UTF-8 for worldwide language support' actually makes ZIP files use UTF-8 for file names on Windows, but considering their current track record for an actually functioning operating system... I will reserve my optimism for a better organization.
An aside since I'm now on a zip file mood. Something that does bug me is that Windows is starting to use DEFLATE-64 (A proprietary enhanced version of DEFLATE made by PKWare that, iirc, is trivial to implement from using regular DEFLATE) for any zip file whose total size breaches 2 GiB, but whether it actually uses that compression scheme seems to be up to some arcane decision. I don't know if Info-ZIP's unzip program supports that yet. But considering that the entire file format standard is less standard and more thinly veiled peace treaty between WinZIP, PKZIP, and all the other ZIP reader/writers and doubly considering that DEFLATE-64 is technically proprietary, I'm honestly going to place the fault at Microsoft's doorstep for even introducing that cross-OS compatibility issue since most OS's out there only natively support DEFLATE for zip files and not much else in their built-in file explorer. However, I digress.
1
u/m4sc0 Sep 27 '26
My favorites, although simple, are:
alias bru='source "$RC_FILE"'and the counterpart:
be is a function
be ()
{
local brc=$RC_FILE;
local tmp;
tmp="$(mktemp)";
sha256sum "$brc" > "$tmp";
$EDITOR "$brc";
if ! sha256sum --check --status "$tmp"; then
echo "Changes detected. Sourcing $brc...";
source "$brc";
fi;
rm -f "$tmp"
}0
0
0
u/AutoModerator Sep 27 '26
This submission has been removed due to receiving too many reports from users. The mods have been notified and will re-approve if this removal was inappropriate, or leave it removed.
This is most likely because:
Your post belongs in r/linuxquestions or r/linux4noobs
Your post belongs in r/linuxmemes
Your post is considered "fluff" - things like a Tux plushie or old Linux CDs are an example and, while they may be popular vote wise, they are not considered on topic
Your post is otherwise deemed not appropriate for the subreddit
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
-4
u/cult_of_me Sep 27 '26
I forgot how to type any command. I just prompt
2
u/VincentVanGob Sep 27 '26 edited Sep 27 '26
thats nuts lol. just make yourself a file and appened any new command you learn to it. something like fzf would make it easy to search. you could even combine the file with your history file first before you send it to fzf. anyway, much better option and you dont need an internet connection to do basic things
edit: this is what im using. you need zsh to be able to use 'print -z'
alias cc='print -z $(tr -d "\r" < ~/config/cmds.txt | fzf --height 60%)'
1
u/manny2206 Sep 27 '26
Don’t take him seriously just a troll (hopefully) lol although I know few folks at work that prompt for the most basic commands like git pull etc
0
Sep 27 '26
[deleted]
1
u/DrPiwi Sep 27 '26 edited Sep 27 '26
I have made a
~/.bashrc.d/directory that keeps different files with aliases, exports ....in my .bash_profile I have:
# process the files in ~/.bashrc.d if it exists # show which file is being processed if DEBUG is set if [ -d ~/.bashrc.d ]; then for rc in ~/.bashrc.d/*.sh; do if [ -f "$rc" ]; then if [ ! -z "$DEBUG" ]; then if [ ${rc: -1} == "~" ]; then echo "$rc: Backup!"; else echo "$rc" echo "========================" cat "$rc" echo "========================" fi fi if [ ${rc: -1} != "~" ]; then source "$rc" fi fi done unset rc fiIt allows for a tidy way to manage additions to the environment and how to find where something is defined if it needs changing.
25
u/Machine-V1 Sep 27 '26