Personal Linux hints and howtos
Get 10 largest folders/files in path
du -a /home/ziga | sort -n -r | head -n 10
reference: https://www.cyberciti.biz/faq/linux-find-largest-file-in-directory-recursively-using-find-du/
First you have to install xclip
sudo apt install xclip
Then you can save any output to clipboard:
cat ssh_key.pub | xclip -selection clipboard
You can also set alias for command (in .bashrc
or .zshrc
):
alias copy="xclip -selection clipboard"
Then you can use:
cat ssh_key.pub | copy
-> TMUX (for customization (ctrl+a and mouse click) see tmux conf file in same repo)
For using tabs in tmux use (ctrl+a c) which opens a new tab. To swithc between them use (ctr+a <tab_index>)
To name each tab run inside tmux window session:
tmux rename-window -t otherwindow newname
For naming each window you can install xpanes installation: https://github.com/greymd/tmux-xpanes/wiki/Installation
Common issue: all panes are synced by default
Solution: use default shortcut (ctrl + b) :setw synchronize-panes off
xpanes -e 'ssh -t dewe-db "htop"' 'ssh -t dewe-production "htop"' 'ssh -t dewe-antares "htop"'
etc/fstab Example usage: Disable swp (swap) https://www.redhat.com/sysadmin/etc-fstab
You can also disable swap for current session only by running: sudo swapoff -a
When installing packages that are adding new aliases to our system, we usually want to use them in same terminal session.
This is possible with running command: source ~/.bashrc
Although if you are using zsh or any other alternative to default bash terminal, make sure to source that config file instead.
Use command scp (secure copy).
sudo scp -r local_dir/ <USER>@<IP_ADDR>:<Destination_path>
Note: If you get permission denied, make sure that destination directory is owned by the same user you are transfering files with.
Note2: If you want to transfer files from remote machine to local, just change order of local dir and remote machine.