check available space
This command lists the file system showing used and available space. Add --total flag to display a sum of all resources at the bottom.
df -h
copy
This command lists the file system showing used and available space. Add --total flag to display a sum of all resources at the bottom.
df -h
copy
Copy file to the same directory. Put the name of the file you want to copy after the 'cp' command followed with the name of the new copied file.
cp file-to-copy.txt new-copied-file.txt
copy
Navigate to the directory you want your file to sit in. The command will create a file with a specified name.
touch your-new-file.js
copy
Displays detailed view of all folders and files in a given directory including owners and update dates.
ls -al
copy
Display all partitions and available space in Linux
df -h
copy
Open document in Nano editor.
nano file-to-edit.js
copy
Removes contents of a file but does not delete it.
cat /dev/null > file-to-wipe.txt
copy
Display all groups user belongs to.
groups user-name
copy
Htop is a useful tool for monitoring your system's performance. It displays CPU, RAM, and swap file usage. It also lists all of the running processes.
htop
copy
This command lists all sites enabled on the server.
apache2ctl -S
copy
Lists all installed packages in your Linux/Unix environment.
dpkg --list
copy
Creates a new directory using the second parameter as a name.
mkdir new-directory
copy
Adds executable permissions to a file.
chmod +x filename.html
copy
Move file to a different directory.
mv [file name] [new location]
// i.e.
mv file-to-move.js ./new/directory/for/the/file
copy
Move with all the files to a different directory.
mv folder-name/* /new/destination/folder/
copy
Login to MySQL. Put username after the -u flag and use -p flag to insert password.
mysql -u root -p
copy
Logout from MySQL.
quit
copy
Ping command lets you check the status of the domain name or an IP address
ping domain-to-ping.com
copy
This command lets you preview the contents of the file directly in the console.
cat file-to-preview.js
copy
Deletes file.
shred -uvz file-to-remove.txt
copy
This command will uninstall a given package with all the config files.
sudo apt-get --purge remove package-name
copy
Restart MySQL server installed on Linux
sudo /etc/init.d/mysql restart
copy
This command lets you copy a file from a remote server to your local machine.
scp root@hostname:/path/to/file /path/to/local/destination
copy
Returns top folders in the given directory and their size.
du -sh /var/www/html/path/to/folder/*
copy
Start MySQL server installed on Linux
sudo /etc/init.d/mysql start
copy
Stop MySQL server installed on Linux
sudo /etc/init.d/mysql stop
copy
Show latest entries from the system journal.
journalctl | tail
copy