bash - konradmayer/knowledge-base GitHub Wiki
From https://askubuntu.com/a/222855
Option 1 - If know ahead:
nohup long-running-command &
logs stdout to nohup.log
To redirect output to a specific file use:
nohup long-running-command > logfile.out 2>&1 &
Option 2 - To detach an already running process:
ctrl+z
bg
disown -h
If you want to "background" already running tasks, then Ctrl+Z then run bg to put your most recent suspended task to background, allowing it to continue running. disown will keep the process running after you log out. The -h flag prevents hangup.
https://askubuntu.com/a/392887
tar -tf filename.tar.gz
pipe to tree
to see a tree view
https://askubuntu.com/a/462084
query displays
xrandr --query
mirror (replace eDP-1 and DP-2 with the actual displays)
xrandr --output eDP-1 --same-as DP-2
with type in human readable
df -aTh
ncdu
https://www.redhat.com/sysadmin/manage-linux-tmp-directory
find files in /tmp
of a user with age
find /tmp -type f \( ! -user kmayer \) -atime +2
add -delete
to delete them
find /tmp -type f \( ! -user kmayer \) -atime +2 -delete
lastlog
lastlog -t 365 # user mit login innerhalb der letzten 365 Tage
ps -p <PID>
if just header is printed, the process is dead, otherwise PID, TTY, TIME, CMD is returned
https://stackoverflow.com/a/5475933
find . -size 0 -print -delete
https://superuser.com/a/560610
go into dir and execute
find -type l -exec bash -c 'ln -f "$(readlink -m "$0")" "$0"' {} \;
specify grid with argument tile
(e.g. -tile 4x5
)
montage -mode concatenate file1.jpg file2.jpg output.jpg
https://stackoverflow.com/a/39839346/10943838
added in .bashrc
shopt -s cdable_vars
export myFold=$HOME/Files/Scripts/Main
set env variables from key-value pairs within a file - from https://stackoverflow.com/a/20909045
# basic version
export $(cat .env | xargs)
# also ignore comments and handle values with spaces
export $(grep -v '^#' .env | xargs -d '\n')