closeup photo of black and blue keyboard

Linux Cheat-sheet

As I get into Linux a little more and learn some handy commands, I’m going to document them here.

ssh user@server -m [algorithm] Sometimes when reaching from Windows into Linux you need to force agreement on the security algorithm both sides are using

ssh -Q mac to query what security algorithm are available

nano –linenumbers [file name] text editor

df -h to get list of folders and space in Linux

fdisk -l to get disk info

du -ah to get disk usage for all files and directory

du -sh for current directory

chmod 755 [file_name] grant most everything rights

Ln -s [file or dir name] make symbolic link

unlink [file or dir name] remove symbolic link

rm -d to remove directory

rm -dr to remove not empty directory

history | grep [search term] -A 10 -B 10 ### search history and show the 10 lines before and after

ls -a or -ll to list all files and folders with more details, or hidden ones

ip -c a to get a list of network interfaces in color!

sudo ip addr add [server IP]/24 dev [interface name] set the interface to use given IP, needs the following to turn on

ip link set dev [interface name] up or down, to turn on or off a network interface

ip route add default via [gateway IP] dev [interface name] sets default route to gateway

sudo nano /etc/systemd/resolved.conf, scroll down and un-comment or amend “DNS=” line to add the DNS servers you need. Will have to restart service with sudo systemctl restart systemd-resolved

sudo nano .bashrc (from home directory), scroll down to line 46 or so and un-comment the force_color_prompt line to get colored terminal output. You will have to logout/login to get the change.


Posted

in

by

Tags: