Useful aliases for all

alias doit='sudo apt update -y && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt clean -y'
alias most='history | awk '\''{CMD[$2]++;} END {for (a in CMD) print CMD[a], a;}'\'' | sort -nr | head'

doit - will just update/upgrade/autoremove/clean your pc
most - will parse history and tell you the commands you use more often

You can add those aliases at the bottom of your .bashrc and source .bashrc
__
This post is also a test; I can post new topics for all to see.

3 Likes

Nice! This is a nice example of how community really expands our Linux knowledge. We have a similar thread with alias, BUT it does not include that custom history command. I’m gonna use that. Thanks for sharing! :smiling_face_with_sunglasses:

1 Like

Commands that let you run an app with elevated permissions seem a never ending source of bugs and problems:

gksu - deprecated (not on modern systems anymore)
su-to-root - just does not work most of the time (not yet examined why)
pkexec - does not work in a lot of cases due to missing environment variables

Therefore, I kind of “reintroduced” a gksu to my system but not the one mentioned above. I introduced it as an alias:

alias gksu="pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS"

Be careful though ! Only use it if you really need it and only use it with applications you fully trust ! (which, ofcourse, counts for any privilege elevating tool)

2 Likes