Cheatography
https://cheatography.com
Useful commands
lsb_release -a |
get current version of os |
service <name of service> start/stop/restart/status |
self explanatory |
Initial configuration
sudo apt-get update |
sudo apt-get install git |
sudo apt install net-tools |
sudo apt install vim |
Setup ssh
sudo apt update |
(server) update package repository |
sudo apt install openssh-server |
(server) install ssh |
sudo systemctl status ssh |
(server) check status of service |
sudo ufw allow ssh |
(server) enable firewall |
sudo systemctl enable ssh |
(server) start ssh upon boot |
ssh-keygen |
(client) create key pair |
ssh-copy-id username@remote_host |
(linux) copy public key |
ssh <user>@<ip> mkdir -p /.ssh sudo nano /.ssh/authorized_keys <copy content of .pub file> |
(windows) copy public key |
sudo chown -R <user>:<user> ~/.ssh/authorized_keys |
set ownership of key file |
chmod 700 /home/username/.ssh chmod 600 ~/.ssh/authorized_keys |
(server) set permissions |
ssh <user>@<ip> -i <full path of private key> |
(client) connect |
open C:\Users\<username>\.ssh\config add entry for ip address |
(windows) add entry into ssh config |
Setup xRDP
sudo apt-get install xfce4 |
sudo apt-get install xrdp |
sudo systemctl enable xrdp |
echo xfce4-session >~/.xsession |
sudo service xrdp restart |
sudo passwd rdpuser |
Setup redis
sudo apt install redis-server |
install |
sudo nano /etc/redis/redis.conf |
change to supervised systemd |
sudo systemctl restart redis.service |
sudo systemctl enable /lib/systemd/system/redis-server.service |
|
|
History Operations
~/.bash_history |
contains history even after reboot |
!v |
run last command that starts with v |
!$ |
last argument |
!?etc |
last command contains etc |
history |
show command history |
cd . |
change to home dir |
!30 |
run command at line number 30 from history |
ctrl-r |
search commands, esc or enter to edit or run |
HISTCONTROL=erasedups |
erase duplicate commands from history |
history -c + history -w |
clear history |
history -r |
whenever you last wrote |
Shutdown
shutdown |
shutdown |
reboot |
reboot |
poweroff |
same as shutdown |
halt |
same as shutdown |
init 0 |
same as shutdown |
init 6 |
same as shutdown |
shutdown -r +n "warning" |
reboot in n minutes, display warning |
shutdown -r now |
reboot now |
shutdown -c |
cancel a pending shutdown |
shutdown -h |
shutdown and then halt |
shutdown hh:mm |
shutdown at specified time |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by shribee