Jump to content

I've recently gotten to making some aliases for my Linux terminal and it does make many things easier and quicker. I'm thinking you Linux guys here must have a lot of useful ones.

 

Performance mode: alias performance="echo performance | sudo tee /sys/devices/system/cpu/cpu*/>
Power saving mode: alias powersave="echo powersave | sudo tee /sys/devices/system/cpu/cpu*/cpuf>
My second monitor off (to get freesync working): alias monoff="xrandr --output DVI-D-0 --off"
My second monitor on: alias monon="xrandr --output DVI-D-0 --right-of DisplayPort-0 --auto"
Restarting xorg: alias restartx="sudo systemctl restart display-manager"
Running apt update: alias update="sudo apt update"
Running apt upgrade: alias upgrade="sudo apt upgrade -y"
Shorten "sudo apt remove" into just "remove": alias remove="sudo apt remove"
Shorten "sudo apt install" into just "install" alias install="sudo apt install"
Show current CPU speed: alias cpuspeed="cat /proc/cpuinfo | grep Hz"
Edit bashrc: alias bashrcedit="nano ~/.bashrc"
Apply bashrc: alias bashrcapply="source ~/.bashrc"

 

Anyone else have any useful aliases to share?

Link to comment
https://linustechtips.com/topic/1539323-share-your-bash-aliases/
Share on other sites

Link to post
Share on other sites

It's pretty basic, but here's what I've added to my .bashrc. I use Linux as my daily driver and I mostly do programming on this machine, for both university and my research job.

 

The only really interesting thing I have here is my "dim" command, which I can use to set my monitor to a lower brightness than is normally possible. Entering "dim 0.5" will set it to half brightness for example. Good for night owls like me.

 

image.png.fad5337fb23eb89d45208f114e0e44b1.png

Computer engineering PhD student and RFML researcher

 

Daily Driver:

CPU: Ryzen 7 4800H | GPU: RTX 2060 | RAM: 32GB DDR4 3200MHz C16 | OS: Debian 13

 

Gaming PC:

CPU: Ryzen 5 5600X | GPU: EVGA RTX 2080Ti | RAM: 32GB DDR4 3200MHz C16 | OS: Windows 11

Link to post
Share on other sites

Here's one that let's you sort files/directories by size. Good on a terminal only server to find where your disk space is going:

alias dusch='du -sch .[^.]* * 2>/dev/null | sort -h -r'

 

Remember to either quote or @mention others, so they are notified of your reply

Link to post
Share on other sites

Beside the typical stuff (like: ls show all by default), here are a few that might not be so common:

# What is my public IP
alias ipify="curl https://api64.ipify.org && echo"

# Reset terminal colors to Breath
alias reset_terminal_colors="konsoleprofile colors=Breath"

# SSH srv1
alias sshsrv1="konsoleprofile colors=Gruvbox; ssh srv1; reset_terminal_colors;"

# SSH srv2
alias sshsrv2="konsoleprofile colors=Solarized; ssh srv2; reset_terminal_colors;"

Obviously instead of srv1, srv2, and so on I put the names of those servers there.
I like having a different color scheme for each server I connect to, minimizes the chances of accidentally running a command on a wrong server. 😆
*This is for "Konsole" terminal emulator, works for "Yakuake" as well for me.
 

1 hour ago, dcgreen2k said:

The only really interesting thing I have here is my "dim" command, which I can use to set my monitor to a lower brightness than is normally possible.

You probably already know this (since you said lower than is normally possible),
just in case someone reads this and uses it to control brightness
man xrandr:

Quote

--brightness brightness
 Multiply the gamma values on the crtc currently attached to the output to specified floating value. Useful for overly bright or overly dim outputs.  However, this is a software only modification, if your hardware has support to actually  change  the  brightness, you will probably prefer to use xbacklight.

It doesn't effect hw backlight at all, and thus should be used only when you either don't have control over the backlight or the control you do have isn't enough (like in your case).

Link to post
Share on other sites

I have a very sensible alias config or really bash config, which seems to impress quite a few people since I basically live in a temrinal, but that's because I like to share the .bashrc across a lot of systems I manage.

 

https://gitlab.com/10leej/dotfiles/-/blob/master/.bashrc?ref_type=heads#L68

Link to post
Share on other sites

On 11/5/2023 at 12:21 AM, dcgreen2k said:

The only really interesting thing I have here is my "dim" command, which I can use to set my monitor to a lower brightness

You might want to check out

 

redshift

 

@dcgreen2kI see fluxgui

 

in your alias, is that flux gui as in https://justgetflux.com/ or something different?

 

It doesn't affect the purplish / grey-purple led glow on a black background, but it can remove a large portion (or 100%) of blue and aqua light.  The way gamma adjustments work, unless you go below 1400 Kelvin correlated color temperature (much more red than a fire: 1750-1900) you'll still see a lot of green light.

 

Green light and blue light have the same effect to delay melatonin production, up to an hour of light exposure  Once you are around the same light source for an hour, the blue light becomes twice as powerful as the green light, but you don't ever read about avoiding green light at night.

 

Harvard's website has an article about it, first published in 2014, updated more recently.

 

To mitigate the blue violet-blue glow, you can change your background color (even in a virtual terminal) to a dark brown / orange to offset or overtake the blue light emission.

 

The command for it on a vt is:

 

As root:

echo -en "\e]P0200800"

P is the color, 0 is which color.
0 black
1 red
2 green
3 doesn't change (yellow?)
4 blue
5 magenta
6 cyan
7 white

The last string of number is the html color code 00 -- FF two characters for red, green, blue

So you can change the background and change the default colors of text and default folder color of blue.

 

Another way to do this, and how I've been testing the commands above

 

setterm --background yellow

It is by default quite orange, and I think I've modified all 8 options before 0-7 but at the moment yellow isn't changing.

 

With setterm and the above commands, you can either modify the foreground and background with the default colors, or use the echo -en command to modify all colors and change 0 2 4 and 7 (black, green blue and white) to whatever you want.

 

This more complicated command also works when fullscreen comnands like top are used.

: JRE #1914 Siddarth Kara

How bad is e-waste?  Listen to that Joe Rogan episode.

 

"Now you get what you want, but do you want more?
- Bob Marley, Rastaman Vibration album 1976

 

Windows 11 will just force business to "recycle" "obscolete" hardware.  Microsoft definitely isn't bothered by this at all, and seems to want hardware produced just a few years ago to be considered obsolete.  They have also not shown any interest nor has any other company in a similar financial position, to help increase tech recycling whatsoever.  Windows 12 might be cloud-based and be a monthly or yearly fee.

 

Software suggestions


Just get f.lux [Link removed due to forum rules] so your screen isn't bright white at night, a golden orange in place of stark 6500K bluish white.

released in 2008 and still being improved.

 

Dark Reader addon for webpages.  Pick any color you want for both background and text (background and foreground page elements).  Enable the preview mode on desktop for Firefox and Chrome addon, by clicking the dark reader addon settings, Choose dev tools amd click preview mode.

 

NoScript or EFF's privacy badger addons can block many scripts and websites that would load and track you, possibly halving page load time!

 

F-droid is a place to install open-source software for android, Antennapod, RethinkDNS, Fennec which is Firefox with about:config, lots of performance and other changes available, mozilla KB has a huge database of what most of the settings do.  Most software in the repository only requires Android 5 and 6!

 

I recommend firewall apps (blocks apps) and dns filters (redirect all dns requests on android, to your choice of dns, even if overridden).  RethinkDNS is my pick and I set it to use pi-hole, installed inside Ubuntu/Debian, which is inside Virtualbox, until I go to a website, nothing at all connects to any other server.  I also use NextDNS.io to do the same when away from home wi-fi or even cellular!  I can even tether from cellular to any device sharing via wi-fi, and block anything with dns set to NextDNS, regardless if the device allows changing dns.  This style of network filtration is being overridden by software updates on some devices, forcing a backup dns provuder, such as google dns, when built in dns requests are not connecting.  Without a complete firewall setup, dns redirection itself is no longer always effective.

Link to post
Share on other sites

I've typed up a post all about sleep and light on another post:

 

https://linustechtips.com/topic/1534591-workplace-problems-because-of-my-chronotype/

 

: JRE #1914 Siddarth Kara

How bad is e-waste?  Listen to that Joe Rogan episode.

 

"Now you get what you want, but do you want more?
- Bob Marley, Rastaman Vibration album 1976

 

Windows 11 will just force business to "recycle" "obscolete" hardware.  Microsoft definitely isn't bothered by this at all, and seems to want hardware produced just a few years ago to be considered obsolete.  They have also not shown any interest nor has any other company in a similar financial position, to help increase tech recycling whatsoever.  Windows 12 might be cloud-based and be a monthly or yearly fee.

 

Software suggestions


Just get f.lux [Link removed due to forum rules] so your screen isn't bright white at night, a golden orange in place of stark 6500K bluish white.

released in 2008 and still being improved.

 

Dark Reader addon for webpages.  Pick any color you want for both background and text (background and foreground page elements).  Enable the preview mode on desktop for Firefox and Chrome addon, by clicking the dark reader addon settings, Choose dev tools amd click preview mode.

 

NoScript or EFF's privacy badger addons can block many scripts and websites that would load and track you, possibly halving page load time!

 

F-droid is a place to install open-source software for android, Antennapod, RethinkDNS, Fennec which is Firefox with about:config, lots of performance and other changes available, mozilla KB has a huge database of what most of the settings do.  Most software in the repository only requires Android 5 and 6!

 

I recommend firewall apps (blocks apps) and dns filters (redirect all dns requests on android, to your choice of dns, even if overridden).  RethinkDNS is my pick and I set it to use pi-hole, installed inside Ubuntu/Debian, which is inside Virtualbox, until I go to a website, nothing at all connects to any other server.  I also use NextDNS.io to do the same when away from home wi-fi or even cellular!  I can even tether from cellular to any device sharing via wi-fi, and block anything with dns set to NextDNS, regardless if the device allows changing dns.  This style of network filtration is being overridden by software updates on some devices, forcing a backup dns provuder, such as google dns, when built in dns requests are not connecting.  Without a complete firewall setup, dns redirection itself is no longer always effective.

Link to post
Share on other sites

Do you have any commands you load just before shutdown, and again as soon as possible at startup?  I can do

 

Crtl r

 

To do a (no so good, but usable) search in bash and at least 75% of the time, find what I am looking for after a few tries of different commands, but here's one for the unbound dns server:

 

Also, how do I automate this at shutdown and startup?  I have added startup comnands in the gui, but I am using the command line runlevel at boot.

 

~/.bashrc

 

alias loadcache='cat unboundfilename.dump | sudo unbound-control load_cache'

 

That's at startup

 

alias dump='sudo unbound-control dump_cache > unboundfilename.dump

Thought of another (usually I just press the UP arrow and hit enter, password and enter again, just as fast to me.

 

alias pail='sudo pihole tail'

 

I seriously like to watch the dns requests go by when connecting a new device, with a * wildcard to initially block everything.  I then do a ctrl - c and do

 

sudo pihole blacklist domainname

 

The real question is, can I shorten "sudo pihole blacklist" to "block", hit space bar after an alias of that and add a domain name?  Could I do instead

 

block domainname

: JRE #1914 Siddarth Kara

How bad is e-waste?  Listen to that Joe Rogan episode.

 

"Now you get what you want, but do you want more?
- Bob Marley, Rastaman Vibration album 1976

 

Windows 11 will just force business to "recycle" "obscolete" hardware.  Microsoft definitely isn't bothered by this at all, and seems to want hardware produced just a few years ago to be considered obsolete.  They have also not shown any interest nor has any other company in a similar financial position, to help increase tech recycling whatsoever.  Windows 12 might be cloud-based and be a monthly or yearly fee.

 

Software suggestions


Just get f.lux [Link removed due to forum rules] so your screen isn't bright white at night, a golden orange in place of stark 6500K bluish white.

released in 2008 and still being improved.

 

Dark Reader addon for webpages.  Pick any color you want for both background and text (background and foreground page elements).  Enable the preview mode on desktop for Firefox and Chrome addon, by clicking the dark reader addon settings, Choose dev tools amd click preview mode.

 

NoScript or EFF's privacy badger addons can block many scripts and websites that would load and track you, possibly halving page load time!

 

F-droid is a place to install open-source software for android, Antennapod, RethinkDNS, Fennec which is Firefox with about:config, lots of performance and other changes available, mozilla KB has a huge database of what most of the settings do.  Most software in the repository only requires Android 5 and 6!

 

I recommend firewall apps (blocks apps) and dns filters (redirect all dns requests on android, to your choice of dns, even if overridden).  RethinkDNS is my pick and I set it to use pi-hole, installed inside Ubuntu/Debian, which is inside Virtualbox, until I go to a website, nothing at all connects to any other server.  I also use NextDNS.io to do the same when away from home wi-fi or even cellular!  I can even tether from cellular to any device sharing via wi-fi, and block anything with dns set to NextDNS, regardless if the device allows changing dns.  This style of network filtration is being overridden by software updates on some devices, forcing a backup dns provuder, such as google dns, when built in dns requests are not connecting.  Without a complete firewall setup, dns redirection itself is no longer always effective.

Link to post
Share on other sites

On 11/8/2023 at 4:35 PM, E-waste said:

I see fluxgui

in your alias, is that flux gui as in https://justgetflux.com/ or something different?

Yes, it's f.lux. I've been using it since 2012 and it's been great for reducing blue light as you mentioned. The main problem I have with my monitors is that they're incredibly bright at night, even at their minimum supported brightness. The dim command I use has been very helpful in alleviating that issue.

Computer engineering PhD student and RFML researcher

 

Daily Driver:

CPU: Ryzen 7 4800H | GPU: RTX 2060 | RAM: 32GB DDR4 3200MHz C16 | OS: Debian 13

 

Gaming PC:

CPU: Ryzen 5 5600X | GPU: EVGA RTX 2080Ti | RAM: 32GB DDR4 3200MHz C16 | OS: Windows 11

Link to post
Share on other sites

12 hours ago, dcgreen2k said:

Yes

Does it work?  I mean, does the gui work, and on what desktop is it compatible, because it is like they 100% gave up on Linux development for the gui since Ubuntu 10.10.  Has it since been improved, or should a developer go in and try to rework the gui code?  I guess the developers aren't too enthused with the multiple interface toolkits on Linux, and probably find it too time consuming to constantly update the interface for eaxh new desktop change.

: JRE #1914 Siddarth Kara

How bad is e-waste?  Listen to that Joe Rogan episode.

 

"Now you get what you want, but do you want more?
- Bob Marley, Rastaman Vibration album 1976

 

Windows 11 will just force business to "recycle" "obscolete" hardware.  Microsoft definitely isn't bothered by this at all, and seems to want hardware produced just a few years ago to be considered obsolete.  They have also not shown any interest nor has any other company in a similar financial position, to help increase tech recycling whatsoever.  Windows 12 might be cloud-based and be a monthly or yearly fee.

 

Software suggestions


Just get f.lux [Link removed due to forum rules] so your screen isn't bright white at night, a golden orange in place of stark 6500K bluish white.

released in 2008 and still being improved.

 

Dark Reader addon for webpages.  Pick any color you want for both background and text (background and foreground page elements).  Enable the preview mode on desktop for Firefox and Chrome addon, by clicking the dark reader addon settings, Choose dev tools amd click preview mode.

 

NoScript or EFF's privacy badger addons can block many scripts and websites that would load and track you, possibly halving page load time!

 

F-droid is a place to install open-source software for android, Antennapod, RethinkDNS, Fennec which is Firefox with about:config, lots of performance and other changes available, mozilla KB has a huge database of what most of the settings do.  Most software in the repository only requires Android 5 and 6!

 

I recommend firewall apps (blocks apps) and dns filters (redirect all dns requests on android, to your choice of dns, even if overridden).  RethinkDNS is my pick and I set it to use pi-hole, installed inside Ubuntu/Debian, which is inside Virtualbox, until I go to a website, nothing at all connects to any other server.  I also use NextDNS.io to do the same when away from home wi-fi or even cellular!  I can even tether from cellular to any device sharing via wi-fi, and block anything with dns set to NextDNS, regardless if the device allows changing dns.  This style of network filtration is being overridden by software updates on some devices, forcing a backup dns provuder, such as google dns, when built in dns requests are not connecting.  Without a complete firewall setup, dns redirection itself is no longer always effective.

Link to post
Share on other sites

1 hour ago, E-waste said:

Does it work?  I mean, does the gui work, and on what desktop is it compatible, because it is like they 100% gave up on Linux development for the gui since Ubuntu 10.10.  Has it since been improved, or should a developer go in and try to rework the gui code?  I guess the developers aren't too enthused with the multiple interface toolkits on Linux, and probably find it too time consuming to constantly update the interface for eaxh new desktop change.

The GUI is nowhere near as polished as the Windows version, but it works. It also uses redshift as its backend instead of the original xflux, which explains why it still works today. I'm using it on PopOS 22.04 with the default Cosmic DE.

 

flux.png.d3e1d4d2a76fe9697bbc2637793366ff.png

Computer engineering PhD student and RFML researcher

 

Daily Driver:

CPU: Ryzen 7 4800H | GPU: RTX 2060 | RAM: 32GB DDR4 3200MHz C16 | OS: Debian 13

 

Gaming PC:

CPU: Ryzen 5 5600X | GPU: EVGA RTX 2080Ti | RAM: 32GB DDR4 3200MHz C16 | OS: Windows 11

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×