Linux commands

Reading Time: 1 minute

Linux commands that I frequently use

Open a file

sudo vim server.log

Open a log file and display the last 10 lines

tail -f /opt/keycloak/standalone/log/server.log

Exit vim without saving

Press Esc
Press “:”
Press “q!”

Save and exit vim

Press Esc
Press “:w”
Press “:x”

Create new file

$ cat > daemon.json

CTRL + D to save and exit

Copy a file from source to destination directory

sudo cp source destination

Check which process is listening on which port

sudo netstat -plnt (check all ports)
sudo netstat -plnt | grep ‘:80’ (chekc for only port 80)

List files with details

ls -la

Leave a Reply

Your email address will not be published. Required fields are marked *