Command | Action |
---|
Tab | Auto-Complete file and folder names |
Ctrl + A | Go to the beginning of the line that you are currently typing on |
Ctrl + E | Go to the end of the line that you are currently typing on |
Ctrl + U | Clear the line before the cursor |
Ctrl + K | Clear the line after the cursor |
Ctrl + W | Delete the word before the cursor |
Ctrl + T | Swap the last two characters before the cursor |
Esc + T | Swap the last two words before the cursor |
Ctrl + L | Clear the screen |
Ctrl + C | Kill any Unix program that is running |
Ctrl + D | Exit the current shell |
Option + Right Key | Move the cursor forwards one word |
Option + Left Key | Move the cursor backwards one word |
Ctrl + F | Move the cursor one character forwards |
Ctrl + B | Move the cursor one character Backwards |
Ctrl + Y | Paste whatever was cut by the previous command |
Ctrl + Z | Make your running process into a suspended background process |
Ctrl + _ | Undo the previous command |
Option + Shift + Cmd + C | Copy plain text |
Shift + Cmd + V | Paste the selection |
exit | End a shell session |
Command | Action |
---|
ls | Display the name of files and subdirectories in the directory |
ls -C | Force multi-column output of the listing |
ls -a | List all entries including those with . and .. |
ls -1 | Output the list of files in one entry per line format |
ls -F | Display a / immediately after each path that is a directory, * after executable programs or scripts, and @ after a symbolic link |
ls -S | Sort files or entries by size |
ls -l | List in a long format. Includes file mode, owner and group name, date and time file was modified, pathname, and more |
ls -l / | List of the file system from root with symbolic links |
ls -lt | List the files sorted by time modified (most recent first) |
ls -lh | Long listing with human readable file sizes in KB, MB, or GB |
ls -lo | List the file names with size, owner, and flags |
ls -la | List detailed directory contents, including hidden files |
Command | Action |
---|
mkdir <dir> | Create new folder named <dir> |
mkdir -p <dir>/<dir> | Create nested folders |
mkdir <dir1> <dir2> <dir3> | Create several folders at once |
mkdir "<dir>" | Create a folder with a space in the filename |
rmdir <dir> | Delete a folder (only works on empty folders) |
rm -R <dir> | Delete a folder and its contents |
touch <file> | Create a new file without any extension |
cp <file> <dir> | Copy a file to the folder |
cp <file> <newfile> | Copy a file to the current folder |
cp <file>~/<dir>/<newfile> | Copy a file to the folder and rename the copied file |
cp -R <dir> <"new dir"> | Copy a folder to a new folder with spaces in the filename |
cp -i <file><dir> | Prompts you before copying a file with a warning overwrite message |
cp <file1> <file2> <file3>/Users/<dir> | Copy multiple files to a folder |
ditto -V [folder path][new folder] | Copy the contents of a folder to new folder. In here "-V" print a line of status for every file copied |
rm <file> | Delete a file (This deletes the file permanently; use with caution.) |
rm -i <file> | Delete a file only when you give confirmation |
rm -f <file> | Force removal without confirmation |
rm <file1> <file2> <file3> | Delete multiple files without any confirmation |
mv <file> <newfilename> | Move/rename |
mv <file> <dir> | Move a file to the folder, possibly by overwriting an existing file |
mv -i <file> <dir> | Optional -i flag to warn you before overwriting the file |
mv *.png ~/<dir> | Move all PNG files from current folder to a different folder |
Command | Action |
---|
ps -ax | Output currently running processes. Here, a shows processes from all users and x shows processes that are not connected with the Terminal |
ps -aux | Shows all the processes with %cpu, %mem, page in, PID, and command |
top | Display live information about currently running processes |
top -ocpu -s 5 | Display processes sorted by CPU usage, updating every 5 seconds |
top -o rsize | Sort top by memory usage |
kill PID | Quit process with ID <PID>. You'll see PID as a column in the Activity Monitor |
Command | Action |
---|
ping <host> | Ping host and display status |
whois <domain> | Output whois info for a domain |
curl -O <url/to/file> | Download file via HTTP, HTTPS, or FTP |
ssh <username>@<host> | Establish SSH connection to <host> with user <username> |
scp <file><user>@<host>:/remote/path | Copy <file> to a remote <host> |
arp -a | View a list of all devices on your local network. It will show you the IP and MAC address of all the devices |
ifconfig en0 | View your device IP and MAC address |
traceroute [hostname] | Identify the path and the hops traversed by the packets from your device to the destination address |
Command | Action |
---|
brew doctor | Check brew for potential problems |
brew help | List of useful homebrew formula and cask commands |
brew list --formula | List only installed formulas |
brew list --cask | List only installed cask |
brew outdated --formula | Search for outdated formula |
brew outdated --cask | Search for outdated cask |
brew pin [installed_formula] | Pin a formula from getting upgraded |
brew unpin [installed_formula] | Unpin to upgrade a package |
brew cleanup | Remove stale lock files and outdated packages for all formula and casks. |
0 commentaires