This command lists the file system showing used and available space. Add --total flag to display a sum of all resources at the bottom.

#cli#file#linux
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.

#cli#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.

#cli#file
touch your-new-file.js
copy

Displays detailed view of all folders and files in a given directory including owners and update dates.

#cli#linux
ls -al
copy

Display all partitions and available space in Linux

#cli#file
df -h
copy

Open document in Nano editor.

#cli#nano
nano file-to-edit.js
copy

Removes contents of a file but does not delete it.

#cli#file
cat /dev/null > file-to-wipe.txt
copy

Display all groups user belongs to.

#cli#linux
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.

#cli#tooling
htop
copy

This command lists all sites enabled on the server.

#cli#linux
apache2ctl -S
copy

Lists all installed packages in your Linux/Unix environment.

#cli#packages
dpkg --list
copy

Creates a new directory using the second parameter as a name.

#cli
mkdir new-directory
copy

Adds executable permissions to a file.

#cli#file#linux
chmod +x filename.html
copy

Move file to a different directory.

#cli#file
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.

#cli#folder
mv folder-name/* /new/destination/folder/
copy

Login to MySQL. Put username after the -u flag and use -p flag to insert password.

#cli#mysql
mysql -u root -p
copy

Logout from MySQL.

#cli#mysql
quit
copy

Ping command lets you check the status of the domain name or an IP address

#cli
ping domain-to-ping.com
copy

This command lets you preview the contents of the file directly in the console.

#cli#file
cat file-to-preview.js
copy

Deletes file.

#cli#file
shred -uvz file-to-remove.txt
copy

This command will uninstall a given package with all the config files.

#cli#packages
sudo apt-get --purge remove package-name
copy

Restart MySQL server installed on Linux

#cli#file#mysql
sudo /etc/init.d/mysql restart
copy

Returns top folders in the given directory and their size.

#cli#file
du -sh /var/www/html/path/to/folder/*
copy

Start MySQL server installed on Linux

#cli#file#mysql
sudo /etc/init.d/mysql start
copy

Stop MySQL server installed on Linux

#cli#file#mysql
sudo /etc/init.d/mysql stop
copy

Show latest entries from the system journal.

#cli#linux
journalctl | tail
copy
NordVPN NordVPN