{{tag> linux bash alias tar .bash_aliases configure configuration bashrc command script .bashrc history sudo visudo dimmer ps kill nightmode xrandr tar archive "default editor" editor}}
======BASH Customisation======
The standard BASH colour configuration uses a blue colour for listing directories (ls) which is difficult to read on a black background. While this is the "standard colour", due to the impracticality I have decided to change it.
The personal BASH user configuration file is: ''~/.bashrc''. Simply add the following line to this file: ''%%LS_COLORS='di=1;32'%% ; export LS_COLORS'' The code 1;32; is for a light green colour.
The ''.bashrc'' file also has a number of other interesting "features" and options, such as aliases and colour prompts. If you turn on the colour prompt option (force_color_prompt=yes), again the dark blue colour may be difficult to read so I change the prompt color code from 34 to 36.
To update the terminal, without logging off type: '' ~/.bashrc'' or ''source ~/.bashrc''. The command ''exec bash'' will also work.
Add the following commands to ''vim ~/.bashrc'', the aliases can also be added to the separate file .bash_aliases, ''vim ~/.bash_aliases'':
*''alias ll=%%'ls -lah --time-style=long-iso --color=auto'%%''
*''alias lh=%%'ls -laL --color=auto'%%''
* key ''ls'' options :
* ''-a'', ''%%--all%%'' : do not ignore entries starting with . (do not ignore hidden files)
* ''-l'' : use a long listing format
* ''-L'', ''%%--dereference%%'' : when showing file information for a symbolic link, show information for the file the link references rather than for the link itself
* ''-h'' : use binary abbreviation (e.g. 1k 10G 2T, etc.)
* ''-i'' : show index number of each file
* ''-R'' : list sub-directories recursively
* ''-S'' : sort by file size, largest first
* ''-t'' : sort by time
* ''%%--time-style%%'' : allows the displayed time sytle to be changed.
* The standard output is a disgrace, North American mixed up! Aug 23 2022 or Jan 1 11:44 for nearer dates.
* ''iso'' gives 2023-01-23 for more than a year past and 10-23 15:51 for less than a few months past, yuk!
* ''long-iso'' always gives yyyy-mm-dd hh:mm, without a doubt the best format, clean and consistant!
* ''full-iso'' is same as long-iso, except time time is to the nanosecond and local timezone delta is displayed
* The ''TIME_STYLE'' environment variable sets the default
++++An example alias file:|
# This is my current / up-to-date list of bash aliases.
# This is the exact same file that is on all of my hosts - synced using Synthing.
# Aliases will automatically adapt slightly based on the host.
# SOURCE ENVIRONMENTAL VARIABLES FOR BASH_ALIASES
# Sensitive information goes into the .env file - this allows me to share my bash aliases with the community
# Rename shared/config/bash_aliases.env.example and use it as a starter
source ~/.bash_aliases.env
# DOCKER COMMON - All docker commands start with "d"
alias dstop='sudo docker stop $(docker ps -a -q)'
alias dstopall='sudo docker stop $(sudo docker ps -aq)'
alias drm='sudo docker rm $(docker ps -a -q)'
alias dprunevol='sudo docker volume prune'
alias dprunesys='sudo docker system prune -a'
alias ddelimages='sudo docker rmi $(docker images -q)'
alias derase='dstopcont ; drmcont ; ddelimages ; dvolprune ; dsysprune'
alias dprune='ddelimages ; dprunevol ; dprunesys'
alias dexec='sudo docker exec -ti'
alias dps='sudo docker ps -a'
alias dpss='sudo docker ps -a --format "table {{.Names}}\t{{.State}}\t{{.Status}}\t{{.Image}}" | (sed -u 1q; sort)'
alias ddf='sudo docker system df'
alias dlogs='sudo docker logs -tf --tail="50" '
alias dp600='sudo chown -R root:root /home/$BA_USERNAME/docker/secrets ; sudo chmod -R 600 /home/$BA_USERNAME/docker/secrets ; sudo chown -R root:root /home/$BA_USERNAME/docker/.env ; sudo chmod -R 600 /home/$BA_USERNAME/docker/.env'
alias dp777='sudo chown -R $BA_USERNAME:$BA_USERNAME /home/$BA_USERNAME/docker/secrets ; sudo chmod -R 777 /home/$BA_USERNAME/docker/secrets ; sudo chown -R $BA_USERNAME:$BA_USERNAME /home/$BA_USERNAME/docker/.env ; sudo chmod -R 777 /home/$BA_USERNAME/docker/.env'
# depends on having jq installed, but makes it so much easier. https://github.com/htpcBeginner/docker-traefik/commit/d827c85565767c761e100a133088135cba5c3ffa
alias dips="sudo docker ps -q | xargs -n 1 docker inspect --format '{{json .}}' | jq -rs 'map(.Name,.NetworkSettings.Networks[].IPAddress) | .[]'"
dip() {
sudo docker inspect --format '{{json .}}' "$1" | jq -rs 'map(.NetworkSettings.Networks[].IPAddress) | .[]'
}
# DOCKER COMPOSE FILE BY HOSTNAME
# I am sure there is a better way than using $HOSTNAME - if you do, feel free to share/contribute
case $HOSTNAME in
cDoc|CDOC|cdoc)
alias dcrun2='sudo docker compose -f /home/$BA_USERNAME/docker/docker-compose-t2.yml'
;;
dSHB|DSHB|dshb)
alias dcrun2='sudo docker compose -f /home/$BA_USERNAME/docker/docker-compose-t2-web.yml'
;;
DMS)
alias dcrun2='sudo docker compose -f /home/$BA_USERNAME/docker/docker-compose.yml'
;;
zSyn|zsyn|ZSYN)
alias dcrun2='sudo docker-compose -f /volume1/docker/docker-compose-t2-synology.yml'
;;
*)
esac
# DOCKER COMPOSE TRAEFIK 2 - All docker-compose commands start with "dc"
alias dclogs2='dcrun2 logs -tf --tail="50" '
alias dcup2='dcrun2 up -d --build --remove-orphans'
alias dcdown2='dcrun2 down --remove-orphans'
alias dcrec2='dcrun2 up -d --force-recreate'
alias dcstop2='dcrun2 stop'
alias dcrestart2='dcrun2 restart '
alias dcpull2='dcrun2 pull'
alias startbasic='dcup2 $(cat /home/$BA_USERNAME/docker/scripts/cloudserver/basic-services.txt)'
alias stopbasic='dcstop2 $(cat /home/$BA_USERNAME/docker/scripts/cloudserver/basic-services.txt)'
alias stopmedia='dcstop2 $(cat /home/$BA_USERNAME/docker/scripts/cloudserver/media-services.txt)'
alias startmedia='dcup2 $(cat /home/$BA_USERNAME/docker/scripts/cloudserver/media-services.txt)'
alias webrs='dcrec2 php7 redis nginx'
# CROWDSEC
alias cscli='dcrun2 exec -t crowdsec cscli'
alias csdecisions='cscli decisions list'
alias csalerts='cscli alerts list'
alias csinspect='cscli alerts inspect -d'
alias cshubs='cscli hub list'
alias csparsers='cscli parsers list'
alias cscollections='cscli collections list'
alias cshubupdate='cscli hub update'
alias cshubupgrade='cscli hub update'
alias csmetrics='cscli metrics'
alias csmachines='cscli machines list'
alias csbouncers='cscli bouncers list'
alias csfbstatus='sudo systemctl status crowdsec-firewall-bouncer.service'
alias csfbstart='sudo systemctl start crowdsec-firewall-bouncer.service'
alias csfbstop='sudo systemctl stop crowdsec-firewall-bouncer.service'
alias csfbrestart='sudo systemctl restart crowdsec-firewall-bouncer.service'
alias tailkern='sudo tail -f /var/log/kern.log'
alias tailauth='sudo tail -f /var/log/auth.log'
alias tailcsfb='sudo tail -f /var/log/crowdsec-firewall-bouncer.log'
alias csbrestart='dcrec2 traefik-bouncer ; csfbrestart'
# WEB STACK
alias webrs='dcrec2 php7 redis nginx'
# MONITORING STACK
alias dcmlogs2='dcrun2 logs -tf --tail="50" $(cat /home/$BA_USERNAME/docker/scripts/monitoring-services.txt)'
alias dcmrec2='dcrun2 up -d --force-recreate $(cat /home/$BA_USERNAME/docker/scripts/monitoring-services.txt)'
alias dcmstop2='dcrun2 stop $(cat /home/$BA_USERNAME/docker/scripts/monitoring-services.txt)'
# DOCKER TRAEFIK 1 SWARM
alias dslogs='sudo docker service logs -tf --tail="50"'
alias dsps='sudo docker stack ps zstack'
alias dsse='sudo docker stack services zstack'
alias dsls='sudo docker stack ls'
alias dsrm='sudo docker stack rm'
alias dsup='sudo docker stack deploy --compose-file /home/$BA_USERNAME/docker/docker-compose-swarm.yml zstack'
alias dshelp='echo "dslogs dsps dsse dsls dsrm dsup"'
# MOSQUITTO
alias mossub="mosquitto_sub -v -u $BA_MOSQUITTO_USERNAME -P $BA_MOSQUITTO_PASSWORD -h $BA_MOSQUITTO_HOST -p 1883 -t '#'"
# PiHole
alias pidis='bash /home/$BA_USERNAME/server/scripts/pihole-disable.sh'
alias pien='bash /home/$BA_USERNAME/server/scripts/pihole-enable.sh'
alias pi10='bash /home/$BA_USERNAME/server/scripts/pihole-10.sh'
alias piup='bash /home/$BA_USERNAME/server/scripts/pihole-update.sh'
alias rpi3up='bash /home/$BA_USERNAME/server/scripts/rpi3-update.sh'
alias rpi0up='bash /home/$BA_USERNAME/server/scripts/rpi0-update.sh'
# VNC
alias vnc1='vncserver -geometry 1270x720 -depth 24'
alias vnckill1='vncserver -kill :1'
# COMPRESSION
alias untargz='tar --same-owner -zxvf'
alias untarbz='tar --same-owner -xjvf'
alias lstargz='tar -ztvf'
alias lstarbz='tar -jtvf'
alias targz='tar -zcvf'
alias tarbz='tar -cjvf'
# NAVIGATION
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'
# SYNC AND COPY
alias scp='scp -r'
alias rsynce='sudo rsync -avzh --progress --force --delete --exclude-from /home/$BA_USERNAME/docker/shared/config/rsync-exclude'
alias rsyncne='sudo rsync -avzh --progress --force --delete'
alias cpn='cp --verbose' # native copy
alias cp='sudo rsync -azh --info=progress2' # copy files with rsync
alias mv='mv --verbose' # native move
# SEARCH AND FIND
alias gh='history|grep' # search bash history
alias findr='sudo find / -name'
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
# TRASH - trash-cli
alias rmt='trash-put'
alias rm='rm -r'
alias tput='trash-put'
alias tempty='trash-empty ; sudo trash-empty ; sudo -H trash-empty'
alias tlist='trash-list'
alias srmt='sudo trash-put'
# FILE SIZE AND STORAGE
alias fdisk='sudo fdisk -l'
alias uuid='sudo vol_id -u'
alias ls='ls -F --color=auto'
alias ll='ls -alh --color=auto'
alias lt='ls --human-readable --color=auto --size -1 -S --classify' # file size sorted
alias lsr='ls --color=auto -t -1' # recently modified
alias mnt='mount | grep -E ^/dev | column -t' # show mounted drives
alias dirsize='sudo du -hx --max-depth=1'
alias dirusage='du -ch | grep total' # Grabs the disk usage in the current directory
alias diskusage='df -hl --total | grep total' # Gets the total disk usage on your machine
alias partusage='df -hlT --exclude-type=tmpfs --exclude-type=devtmpfs' # Shows the individual partition usages without the temporary memory values
alias usage10='du -hsx * | sort -rh | head -10' # Gives you what is using the most space. Both directories and files. Varies on current directory
# BASH
alias baupdate='. ~/.bashrc'
alias baedit='nano /home/$BA_USERNAME/.bash_aliases'
alias bacopy='sudo cp /home/$BA_USERNAME/.bash_aliases* /root/'
alias badomain='echo $BA_DOMAINNAME' # for troubleshooting
# GIT AND SITE MANAGEMENT
alias gcpush='echo "Usage: gcommit ../commits/date.txt" ; cd /home/$BA_USERNAME/docker ; bash scripts/doccheck.sh'
alias gpush='cd /home/$BA_USERNAME/docker ; git push'
alias ggraph='git log --all --decorate --oneline --graph'
# MAIL SERVER
alias nullsend='sudo echo 1 > /var/spool/nullmailer/trigger'
alias tmail1='echo "Tmail1 This mail test needs an email id after tmail1 command" ; echo "Test mail from zNUC using tmail1." | mail -s "tmail1 from zNUC"'
alias tmail2='echo "Tmail2 This is the message body" | mail -s "tmail2 this is the subject" info@$BA_DOMAINNAME -aFrom:server@$BA_DOMAINNAME'
alias tmail3='echo "Test mail from zNUC using tmail3." | mail -s "tmail3 from zNUC" $BA_MYEMAIL1'
alias pftest='mail -s "Postfix Mailgun Test mail" $BA_MYEMAIL1 <<< "A test message using Mailgun and Postfix"'
# UFW FIREWALL
alias ufwenable='sudo ufw enable'
alias ufwdisable='sudo ufw disable'
alias ufwallow='sudo ufw allow'
alias ufwlimit='sudo ufw limit'
alias ufwlist='sudo ufw status numbered'
alias ufwdelete='sudo ufw delete'
alias ufwreload='sudo ufw reload'
# SYSTEMD START, STOP AND RESTART
alias ctlreload='sudo systemctl daemon-reload'
alias ctlstart='sudo systemctl start'
alias ctlstop='sudo systemctl stop'
alias ctlrestart='sudo systemctl restart'
alias ctlstatus='sudo systemctl status'
alias ctlenable='sudo systemctl enable'
alias ctldisable='sudo systemctl disable'
alias ctlactive='sudo systemctl is-active'
alias shellstart='ctlstart shellinabox'
alias shellstop='ctlstop shellinabox'
alias shellrestart='ctlrestart shellinabox'
alias shellstatus='ctlstatus shellinabox'
alias sshstart='ctlstart ssh'
alias sshstop='ctlstop ssh'
alias sshrestart='ctlrestart ssh'
alias sshstatus='ctlstatus ssh'
alias ufwstart='ctlstart ufw'
alias ufwstop='ctlstop ufw'
alias ufwrestart='ctlrestart ufw'
alias ufwstatus='ctlstatus ufw'
alias webminstart='ctlstart webmin'
alias webminstop='ctlstop webmin'
alias webminrestart='ctlrestart webmin'
alias webminstatus='ctlstatus webmin'
alias sambastart='ctlstart smbd'
alias sambastop='ctlstop smbd'
alias sambarestart='ctlrestart smbd'
alias sambastatus='ctlstatus smbd'
alias nfsstart='ctlstart nfs-kernel-server'
alias nfsstop='ctlstop nfs-kernel-server'
alias nfsrestart='ctlrestart nfs-kernel-server'
alias nfsstatus='ctlstatus nfs-kernel-server'
alias nfsreload='sudo exportfs -a'
# INSTALLATION AND UPGRADE
alias update='sudo apt-get update'
alias upgrade='sudo apt-get update && sudo apt-get upgrade'
alias install='sudo apt-get install'
alias finstall='sudo apt-get -f install'
alias rinstall='sudo apt-get -f install --reinstall'
alias uninstall='sudo apt-get remove'
alias search='sudo apt-cache search'
alias addkey='sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com'
# CLEANING
alias clean='sudo apt-get clean && sudo apt-get autoclean'
alias remove='sudo apt-get remove && sudo apt-get autoremove'
alias purge='sudo apt-get purge'
alias deborphan='sudo deborphan | xargs sudo apt-get -y remove --purge'
alias cleanall='clean && remove && deborphan && purge'
# SHUTDOWN AND RESTART
alias shutdown='sudo shutdown -h now'
alias reboot='sudo reboot'
# NETWORKING
alias portsused='sudo netstat -tulpn | grep LISTEN'
alias showports='netstat -lnptu'
alias showlistening='lsof -i -n | egrep "COMMAND|LISTEN"'
alias ping='ping -c 5'
alias ipe='curl ipinfo.io/ip' # external ip
alias ipi='ipconfig getifaddr en0' # internal ip
alias header='curl -I' # get web server headers
# SYNOLOGY DSM COMMANDS
alias servicelist='sudo synoservicecfg --list' # does not work in DSM 7
alias servicestatus='sudo synosystemctl status'
alias servicestop='sudo synosystemctl stop'
alias servicehstop='sudo synoservicecfg --hard-stop' # does not work in DSM 7
alias servicestart='sudo synosystemctl start'
alias servicehstart='sudo synoservicecfg --hard-start' # does not work in DSM 7
alias servicerestart='sudo synosystemctl restart'
alias restartdocker='sudo synosystemctl restart pkgctl-Docker'
# MISCELLANEOUS
alias wget='wget -c'
alias nano='sudo nano -iSw$'
alias scxterm='bash /home/$BA_USERNAME/docker/scripts/xterm.sh'
# SYSTEM MONITORING
alias meminfo='free -m -l -t' # memory usage
alias psmem='ps auxf | sort -nr -k 4' # get top process eating memory
alias psmem10='ps auxf | sort -nr -k 4 | head -10' # get top process eating memory
alias pscpu='ps auxf | sort -nr -k 3' # get top process eating cpu
alias pscpu10='ps auxf | sort -nr -k 3 | head -10' # get top process eating cpu
alias cpuinfo='lscpu' # Get server cpu info
alias gpumeminfo='grep -i --color memory /var/log/Xorg.0.log' # get GPU ram on desktop / laptop
alias free='free -h'
# RCLONE
alias rcdlogs='tail -f /home/$BA_USERNAME/docker/logs/cloudserver/rclone-drive.log'
alias rcclogs='tail -f /home/$BA_USERNAME/docker/logs/cloudserver/rclone-crypt.log'
alias rcupmedia='bash /home/$BA_USERNAME/docker/scripts/cloudserver/upload-media-now.sh'
alias rcupmedialogs='tail -f /home/$BA_USERNAME/docker/logs/cloudserver/upload-media-now.log'
alias rcupdump='bash /home/$BA_USERNAME/docker/scripts/cloudserver/upload-dump.sh'
alias rcupdumplogs='tail -f /home/$BA_USERNAME/docker/logs/cloudserver/upload-dump.log'
alias rcrestart='sudo bash /home/$BA_USERNAME/docker/scripts/rclone-restart.sh'
alias rcstop='sudo bash /home/$BA_USERNAME/docker/scripts/rclone-stop.sh'
alias rcstart='sudo bash /home/$BA_USERNAME/docker/scripts/rclone-start.sh'
alias rcstatus='sudo bash /home/$BA_USERNAME/docker/scripts/rclone-status.sh'
alias rcps="ps -ef | grep '/usr/bin/rclone sync\|/usr/bin/rclone copy\|/usr/bin/rclone move'" # see running rclone copy sync or move
# YT-DLP
alias ytupdate='yt-dlp -U'
alias ytlist='yt-dlp --list-formats'
alias ytdump='yt-dlp --dump-json'
alias ytdv='yt-dlp --config-location /home/$BA_USERNAME/docker/appdata/yt-dlp/yt-dlp-video.conf'
alias ytdvc='yt-dlp --cookies "/home/$BA_USERNAME/docker/appdata/yt-dlp/cookies.txt" --config-location /home/$BA_USERNAME/docker/appdata/yt-dlp/yt-dlp-video.conf'
alias ytda='yt-dlp --config-location /home/$BA_USERNAME/docker/appdata/yt-dlp/yt-dlp-audio.conf'
alias ytdac='yt-dlp --cookies "/home/$BA_USERNAME/docker/appdata/yt-dlp/cookies.txt" --config-location /home/$BA_USERNAME/docker/appdata/yt-dlp/yt-dlp-audio.conf'
++++
To allow the BASH history to be updated from each terminal after each command, instead of last closed bash terminal overwriting others upon closure add:
export HISTTIMEFORMAT="%d/%m/%y %T "
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend
PROMPT_COMMAND="history -w"
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
To reload bash: ''exec bash''
The following command gives an example of time format control on ls command. %%ls -l --time-style="+%Y-%m-%d %H:%M:%S"%%
=====BASH History Customisation and Use=====
* history | grep command -> to see list of history with text "command"
* history !x -> to repeat the history command at line x
* history -d x -> to delete history line x
Links:
* [[https://www.digitalocean.com/community/tutorials/how-to-use-bash-history-commands-and-expansions-on-a-linux-vps|How To Use Bash History Commands and Expansions on a Linux VPS]]
* [[https://opensource.com/article/20/6/bash-history-control|Make Bash history more useful with these tips]]
* danyspin97's site [[https://danyspin97.org/blog/colorize-your-cli/|Colorize your CLI]]
* [[https://www.gnu.org/software/bash/manual/html_node/index.html#SEC_Contents|Bash Reference Manual]]
* shopt [[https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html|The Shopt Builtin] sh options, simply type ''shopt'' to see list with current settings. Looks like built ins only?
* set [[https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html|The Set Builtin]] set options, ''set'' on its own list entire content. (Looks like user defined?)
====bash-it / oh-my-bash====
bash configuration utilities I have not tried yet.
References:
*[[https://bash-it.readthedocs.io/en/latest/|Welcome to Bash-it’s documentation!]]
*[[https://github.com/ohmybash/oh-my-bash|oh-my-bash]]
====exa====
A modern replacement for ls.
I tried it and could not be bothered with it and uninstalled.
====grc====
General colouriser. I installed it but do not bother to use it normally.
====ble.sh====
ble.sh is a tool for bash that add command line continuation and colouring as well as other features.
blesh seems to swamp the ''set'' variables. Pipe to less as the list is so long I it fill my terminal buffer on straight output.
**Like it and use it**
Reference:
*[[https://github.com/akinomyoga/ble.sh|ble.sh ―Bash Line Editor―]]
====BASH Prompt====
I like a standard looking prompt, none of these Apple look alike things that seem to be popular on the nerd media at the moment. I do not see much value in the prompt showing the date as this is shown on the main GUI screen.
References
*[[https://www.howtogeek.com/307701/how-to-customize-and-colorize-your-bash-prompt/|How to Customize (and Colorize) Your Bash Prompt]]
====Colors====
Seems like the main terminal colors is 1bit (light and dark), 4 bit or 16 colors, while "expanded" is 256 colors. The pallet the colors can be selected from can be varied from 24bits (16M) on more modern systems.
The LS command allows the colors to be changed via the LS_COLOR environment variable.
Similarly programs like vim allow its colors to be varied.
The terminal programs can have their colors adjusted there. I problem I encounter was the dark blue on black background was illegible. Changing the dark blue to a lighter blue resolved this issue. I also changed the white to yellow so the text is more appealing to read, at least for me.
Some interesting references on this are:
*[[https://opensource.com/article/19/9/linux-terminal-colors|How to change the color of your Linux terminal]] Make Linux as colorful (or as monochromatic) as you want.
*ShellHacks [[https://www.shellhacks.com/bash-colors/|Bash Colors]]
*[[https://superuser.com/questions/1114549/how-do-you-change-the-color-scheme-in-bash-on-ubuntu-for-windows|How do you change the color scheme in bash on Ubuntu for Windows?]]
*[[https://www.tecmint.com/customize-bash-colors-terminal-prompt-linux/|How to Customize Bash Colors and Content in Linux Terminal Prompt]]
*[[https://askubuntu.com/questions/558280/changing-colour-of-text-and-background-of-terminal|Changing colour of text and background of terminal?]]
*[[https://www.howtogeek.com/307899/how-to-change-the-colors-of-directories-and-files-in-the-ls-command/|How to Change the Colors of Directories and Files in the ls Command]]
======visudo======
sudo remembers your password for 15 minutes by default. After 15 minutes, you will be asked to enter the password again for any sudo command.\\
This is actually a security feature. For instance, if you left the terminal open after running commands with sudo, the authentication automatically expires after 15 minutes of sudo inactivity. So, the other users can’t do any further administrative tasks.
This behaviour can be changed by increasing or decreasing the sudo password timeout limit as described below.\\
''sudo visudo''\\
Find ''Defaults env_reset'' and change to ''Defaults env_reset, timestamp_timeout=30''\\
This will change the default 15 minutes time out to 30 minutes. Changing the timestamp_timeout=0 will require the sudo password at every use. Specifying a negative value and the timeout will never expire.\\
\\
''sudo -k'' resets the sudo timeout and password must be entered again next time sudo is used.\\
\\
The default timeout seems pretty reasonable to me so I can not be bothered changing it!\\
\\
[[https://ostechnix.com/how-to-change-sudo-password-timeout-in-linux/|Change Sudo Password Timeout in Linux]]
-------
=====Display Brightness Control=====
Strangely XFCE does not seem have and any kind of screen brightness control built in. There also seems to be no optional extra for this either. \\
[[https://terracoders.com/blog/bash-simple-script-changing-display-brightness-xrandr|Bash: A Simple Script for Changing Display Brightness with XRANDR]]
*''%%xrandr --listactivemonitors%%'' to list current active monitors
*''%%xrandr --output HDMI-1 --brightness 0.5 && xrandr --output DP-2 --brightness 0.5%%''
*''%%xrandr --output [displayID] --gamma 1.0:0.95:0.85%%'' to give a night mode effect
*''%%xrandr --output HDMI-1 --gamma 1.0:0.9:0.85 --brightness 0.7%%''to give a combined night and dimming effect.
=====Archive=====
=====tar=====
''tar'' comes from tape archive. I was original a program to store and retrieve information to tape backup system. Basic tar functionality did not originally include compression, but this was added later.
====create====
main ''tar'' create options, e.g.: ''tar -cvf archive_filename.tar file1 directory1 file2''
*''-c'' : for create archive, a pretty self-explanatory option if you want to create a new archive made from the files selected;
*''-v'' : for verbose, this is the reason why the command displays the files added to the archive when executing it;
*''-f'' : for file, this option is used in order to specify the filename of the archive we want to create (in this case archive.tar)
====extract====
''tar -xvf archive_filename.tar''
*''-x'' : for extract archive, a pretty self-explanatory option if you want to extract information from an archive.
====list contents====
''tar -tvf 'archive filename'''
=====ps process=====
''ps aux'' to see current process
=====kill process=====
''killall name''
''pkill name''
''pkill -9 name''
=====compression=====
Use either ''gzip'', ''bzip2'', or ''xz'' to directly compress a file
*''gzip'', extension ''.gz'', with ''tar'' use flag ''-z''
*''bzip2'', extension ''.bz2'', with ''tar'' use flag ''-j''
*''xz'', extension ''.xz'', with ''tar'' use flag ''-J''
=====copy & paste=====
See [[https://wiki.kptree.net/doku.php?id=home_server:home_server_setup:other_services:misc#pbcopy_pbpaste|pbcopy pbpaste]]
=====Change Default System Editor=====
Use ''sudo update-alternatives --config editor'' and follow prompts on screen
Reference:
*[[https://unix.stackexchange.com/questions/42726/how-do-i-change-the-default-text-editor-in-the-debian-squeeze-distro|How do I change the default text editor in the Debian (squeeze) distro]]
*[[https://www.baeldung.com/linux/update-alternatives-command|The update-alternatives Command in Linux]]
<- home_server:home_server_setup:other_services:ssh|Prev ^ home_server:home_server_setup:other_services:index|Start page ^ home_server:home_server_setup:other_services:conky|Next ->