Windows
You can open the Command Prompt in Windows by pressing the keyboard shortcut Win-R and typing "cmd". It can also be launched by searching in the Start menu, again by typing "cmd". If you replace the file path in File Explorer with "cmd", the Command Prompt will open with that folder as the current directory.
Commands
cd - change to a different directory, e.g. "cd /Users/user/Desktop"; cd on its own returns you to the root directory; cd .. takes you up to the parent directory; cd ~ takes you to the home directory
dir - lists the contents of the current directory
copy $FILE $LOCATION - copies a file to the specified location; replace $FILE with the file name and $LOCATION with the target path
del $FILE - deletes a file; replace $FILE with the file name
move $FILE $LOCATION - moves a file to the specified location; replace $FILE with the file name and $LOCATION with the folder path
expand $FILE - extracts a file; replace $FILE with the file name
rename $FILE - renames a file; replace $FILE with the file name
replace $FILE - replaces a file with a copied file; replace $FILE with the file name
rmdir $LOCATION - deletes a directory; replace $LOCATION with the folder path
tree - displays the folder structure graphically
ftp - transfers files to an FTP server
ping $URL- sends a request to the specified URL to verify its availability; replace $URL with the actual URL
ipconfig - displays the IP address configuration
netstat - displays TCP/IP connections and their status
cp $FILE $LOCATION - copies a file to the specified location; replace $FILE with the file name and $LOCATION with the target path
macOS
You can find Terminal in Applications under the Utilities folder, or you can launch it via Spotlight by pressing Command + Space. Simply type "Terminal" into the Spotlight search field and confirm with Enter.
Many commands are the same for macOS as they are for Linux. Both operating systems are based on Unix.
Commands
man $COMMAND - displays the manual for the specified command; replace $COMMAND with the relevant command (ls; cd; pwd; sudo; ..)
ls - lists the contents of the current directory (can be used with the parameter ls -l or
ls -aF)
cd - change to a different directory, e.g. "cd /Users/user/Desktop"; cd on its own returns you to the root directory; cd .. takes you up to the parent directory; cd ~ takes you to the home directory
pwd - prints the full path of the current working directory
sudo - authenticate as a superuser to gain additional security permissions; required for more advanced configuration tasks
cp $FILE $LOCATION - copies a file to the specified location; replace $FILE with the file name and $LOCATION with the target path
mv $FILE $LOCATION - moves a file to the specified location; replace $FILE with the file name and $LOCATION with the target path
rm $FILE - removes a file; replace $FILE with the file name
nano $FILE - opens a text editor for the specified file; replace $FILE with the file name
chmod $FOLDER/$FILE - changes permissions for the specified folder or file;
read = 4, write = 2, execute/delete = 1;
(0+0+0) – No permissions.
1 (0+0+1) – Execute/delete only.
2 (0+2+0) – Write only.
3 (0+2+1) – Execute/delete + write.
4 (4+0+0) – Read only.
5 (4+0+1) – Read + execute/delete.
6 (4+2+0) – Read + write.
7 (4+2+1) – Read + write + execute/delete.;
First position - Owner
Second position - Group
Third position - Others
For example, "chmod 750 $FILE" grants the file owner full permissions, the group read and execute/delete permissions, and others no permissions.
ps aux - lists all running processes with their IDs; useful for terminating processes
kill $PID - forces the specified application to quit; particularly useful when an application is not responding
ping $URL- sends a request to the specified URL to verify its availability; replace $URL with the actual URL
defaults write com.apple.finder AppleShowAllFiles TRUE - used to show hidden files; the value TRUE shows hidden files, the value FALSE hides them
defaults write com.apple.finder QuitMenuItem -bool TRUE - enables the option to close all active Finder windows using the CMD + Q shortcut; true = enabled, false = disabled
defaults write com.apple.screencapture EXTENSION-extension - used to change the screenshot format (cmd + shift + 4; cmd + shift + 5); replace "EXTENSION" with the desired format (JPG; PNG; PDF; ..)
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true - displays the full URL in Safari's address bar
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool FALSE - configures autocorrect; false = disabled, true = enabled
say Hello! - your Mac will say "Hello"; you can type whatever you'd like your Mac to say in its default voice :-)
Examples for ABRA Flexi
cp /Library/Application\ Support/FlexiBee/Data/pg_log/startup.log ~/Documents/ - copies startup.log to the "Documents" folder
sudo chmod 777 ~/Documents/startup.log - grants full access permissions for all users to "startup.log"
ps aux | grep chrome - searches for the "chrome" process among running processes
kill -9 3123 - forces the application with ID 3123 to quit (the -9 parameter)
killall -9 chrome - forces the application named "chrome" to quit
Linux
Open the command line using the Terminal application. To launch Terminal, select Applications → Accessories → Terminal from the menu. The default keyboard shortcut to open Terminal is CTRL + ALT + T.
Many commands are the same for Linux as they are for macOS. Both operating systems are based on Unix.
Commands
man $COMMAND - displays the manual for the specified command; replace $COMMAND with the relevant command (ls; cd; pwd; sudo; ..)
ls - lists the contents of the current directory (can be used with the parameter ls -l or
ls -aF)
cd - change to a different directory, e.g. "cd /Users/user/Desktop"; cd on its own returns you to the root directory; cd .. takes you up to the parent directory; cd ~ takes you to the home directory
pwd - prints the full path of the current working directory
sudo - authenticate as a superuser to gain additional security permissions; required for more advanced configuration tasks
cp $FILE $LOCATION - copies a file to the specified location; replace $FILE with the file name and $LOCATION with the target path
mv $FILE $LOCATION - moves a file to the specified location; replace $FILE with the file name and $LOCATION with the target path
rm $FILE - removes a file; replace $FILE with the file name
mkdir $FOLDER_NAME - creates a directory; replace $FOLDER_NAME with the desired folder name
grep text $FILE - attempts to find the text "text" in the specified file; replace $FILE with the file name
locate $TEXT - attempts to find a file based on the specified text; replace $TEXT with the relevant text
cat $FILE - opens the editor for the specified file; replace $FILE with the file name
nano $FILE - opens a text editor for the specified file; replace $FILE with the file name
tail -n $FILE - opens a text editor showing the last 10 lines of a file; the number of displayed lines can be specified
chmod $FOLDER/$FILE - changes permissions for the specified folder or file;
read = 4, write = 2, execute/delete = 1;
(0+0+0) – No permissions.
1 (0+0+1) – Execute/delete only.
2 (0+2+0) – Write only.
3 (0+2+1) – Execute/delete + write.
4 (4+0+0) – Read only.
5 (4+0+1) – Read + execute/delete.
6 (4+2+0) – Read + write.
7 (4+2+1) – Read + write + execute/delete.;
First position - Owner
Second position - Group
Third position - Others
For example, "chmod 750 $FILE" grants the file owner full permissions, the group read and execute/delete permissions, and others no permissions.
ps aux - lists all running processes with their IDs; useful for terminating processes
kill $PID - forces the specified application to quit; particularly useful when an application is not responding
ping $URL- sends a request to the specified URL to verify its availability; replace $URL with the actual URL
du $FOLDER - displays the disk usage of the specified folder; replace $FOLDER with the relevant folder
Examples
cp /Library/Application\ Support/FlexiBee/Data/pg_log/startup.log ~/Documents/ - copies startup.log to the "Documents" folder
sudo chmod 777 ~/Documents/startup.log - grants full access permissions for all users to "startup.log"
ps aux | grep chrome - searches for the "chrome" process among running processes
kill -9 3123 - forces the application with ID 3123 to quit (the -9 parameter)
killall -9 chrome - forces the application named "chrome" to quit
