Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Linux Cheat Sheet

by shribee (shribee) via cheatography.com/79125/cs/19217/

Useful commands Setup redis

lsb_re​lease -a get current version of sudo apt install redis-​server install


os sudo nano /etc/r​edi​s/r​edi​s.conf change to supervised systemd
service <name of servic​e> start/​sto​p/r​est​‐ self explan​atory sudo systemctl restart redis.s​ervice
art​/status
sudo systemctl enable /lib/s​yst​emd​/sy​ste​m/r​edi​s-s​erv​er.s​ervice

Initial config​uration
History Operations
sudo apt-get update
~/.bas​h_h​istory contains history even after reboot
sudo apt-get install git
!v run last command that starts with v
sudo apt install net-tools
!$ last argument
sudo apt install vim
!?etc last command contains etc
history show command history
Setup ssh
cd . change to home dir
sudo apt update (server) update package
repository !30 run command at line number 30 from
history
sudo apt install openss​h-s​erver (server) install ssh
ctrl-r search commands, esc or enter to
sudo systemctl status ssh (server) check status of
edit or run
service
HISTCONTROL=erasedups erase duplicate commands from
sudo ufw allow ssh (server) enable firewall
history
sudo systemctl enable ssh (server) start ssh upon boot
history -c + history -w clear history
ssh-keygen (client) create key pair
history -r whenever you last wrote
ssh-co​py-id userna​me@​rem​ote​_host (linux) copy public key
mkdir -p ~/.ssh (winows) copy public key Shutdown
sudo nano ~/.ssh​/au​tho​riz​ed_keys
shutdown shutdown
<copy content of .pub file>
reboot reboot
sudo chmod -R go= ~/.ssh (server) set permis​sions
poweroff same as shutdown
sudo chown -R <us​er> ~/.ssh
halt same as shutdown
ssh <us​er>​@<i​p> -i <full path of (client) connect
private key> init 0 same as shutdown

init 6 same as shutdown


Setup xRDP
shutdown -r +n "​war​nin​g" reboot in n minutes, display warning
sudo apt-get install xfce4 shutdown -r now reboot now
sudo apt-get install xrdp shutdown -c cancel a pending shutdown
sudo systemctl enable xrdp shutdown -h shutdown and then halt
echo xfce4-​session >~/.xs​ession shutdown hh:mm shutdown at specified time
sudo service xrdp restart
sudo passwd rdpuser

By shribee (shribee) Published 28th March, 2019. Sponsored by Readable.com


cheatography.com/shribee/ Last updated 11th March, 2022. Measure your website readability!
Page 1 of 1. https://readable.com

You might also like