Skip to content

Instantly share code, notes, and snippets.

@kkayacan
Last active July 15, 2020 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkayacan/0e7de050f188c9f493f8511c3cd1e975 to your computer and use it in GitHub Desktop.
Save kkayacan/0e7de050f188c9f493f8511c3cd1e975 to your computer and use it in GitHub Desktop.
Linux quick reference for Debian/Ubuntu/Raspbian
Create directory (only one level can be created, upper levels must exist)
$ mkdir /path/to/directory
Create nested directories
$ mkdir -p /path/to/directory
Open/edit/create file with nano editor
$ sudo nano "/var/www/example.com/public_html/f24434ecdfc7.html"
Move folder
$ sudo mv "/SEAGATE1/Kerem/Downloads/WebTools.bundle" "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins"
List files with permission info
$ ls -l
Change user and group ownership of folder recursively
$ chown -R ownername:groupname foldername
Remove or delete a file
$ rm abc.txt
Remove the folder with all its contents(including all interior folders):
$ rm -rf /path/to/directory
Remove all the contents of the folder(including all interior folders) but not the folder itself:
$ rm -rf /path/to/directory/*
List services
$ systemctl | grep service
Stop service
$ systemctl stop apache2
Start service
$ systemctl start apache2
Reboot
$ sudo reboot
Shutdown and power off
$ sudo shutdown -P now
See last 10 entries in system log
$ sudo tail /var/log/syslog
See last 100 entries in system log
$ sudo tail -n100 /var/log/syslog
See last 100 entries apache web server log
$ sudo tail -n100 /var/log/apache2/access.log
Running processes
$ ps -o pid,sess,cmd afx | egrep -A20 "( |/)cron( -f)?$"
Kill proces
$ kill -9 <PID>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment