Linux
Linux is the standard OS for deploying software today.
Tips and Tricks
SSH Agent Forwarding
This is useful if you use another machine on the network to do "heavier" work
Setting up SSH agent forwarding
Modify the ~/.ssh/config file. If one doesn't exist, you can create it by entering touch ~/.ssh/config
Enter the following example in the config file
Host [example.com]
ForwardAgent yes
Ensure that your /etc/ssh/config file is set up for forwarding
Your config file should look like this
# ForwardAgent no
Host *
SendEnv LANG LC_*
Notice that the ForwardAgent no line is commented out with the # in front of it
Executing the commands
- Ensure that your ssh-key is loaded
ssh-add [your key location]
- SSH to the machine that you have set up
ssh -A [username]@[example.com]
Memory
Show memory slots being used
dmidecode -t memory
Show how many slots are available
dmidecode -t memory | grep -c "Memory Device"
Show how many slots are not used
dmidecode -t memory | grep -c "Size: No Module Installed"
Extract all RAR files in a directory
for file in *.rar; do unrar e "$file"; done
Clear out a log file
sudo < /var/log/somelogfile.txt
Show disk use but only at the top level
sudo du -h -x -d 1 /[some directory name]
Remove application config for user
rm -rf ~/.config/[application name]
Expanding disk space leveraging LVM
Remove duplicate entry from known_hosts
ssh-keygen -f "/home/kelvin/.ssh/known_hosts" -R "windcharger-desktop"
Process Management
Kill all processes related to an application name
killall [some app name]
Utilities
tmux
tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.
Creating a bootable USB key from the command line
sudo dd bs=4M if=/path/to/isoimage.iso of=/dev/sdx status=progress oflag=sync