- Terminal For Hacking
- Terminal Hacks For Mac Os X
- Terminal Hacks For Mac
- Macbook Pro Terminal Commands
- Best Mac Terminal Hacks
Use Terminal Hacks On your Mac OS X For Cool tricks
This is one of the killer hacks that I was craving for since Mountain Lion was announced. Quicklook is a great feature that lets you “peek” at the documents or media files without actually opening the files. You can get this Quicklook feature by the three-finger tap on any file you wish to preview. Terminal Cheatsheet for Mac (Basics) This cheatsheet is available in many languages. Since the translation rely on volunteers, the content between the available languages may vary. On an iPhone or other device, install a MAC spoofing app like MacDaddy X or WifiSpoof. Use that to change your MAC address. On Android, install BusyBox and the Terminal Emulator (apps available for free on Google Play). In the terminal, type 'ip link show' to see a list of interfaces. How to use terminal on mac to hack.
Apple OS X is one of the best operating systems out there. It blends with beautiful hardware of Apple and provides awesome user experience on top of a trusted UNIX system. Talk about UNIX system, OS X provides some great tools for geeks and hackers alike that make Macbook pro their favorite systems. We have seen how we can automate the internet sharing process using the Apple’s automation language – AppleScript. OS X also has an amazing application called the Terminal, that lets you control your whole system the way you see fit!
The Terminal app usually sits in the Utilities or Other folder in the Applications. You do something on the Terminal by typing out the commands. For example, “ifconfig” displays the details of the network you are connected to either wired or wirelessly.
![Terminal hacks on mac Terminal hacks on mac](https://cdn.instructables.com/FYR/7CWX/I8WW0USG/FYR7CWXI8WW0USG.LARGE.jpg)
The Mac Tricks and Tips has this great article on some of the awesome hacks on OS X. There are a list of 22 hacks, some of which are really handy. I am going to list a few of the handy tricks that ought to be set to default on your OS X. You can copy and paste the commands here using ⌘ + C for copy and ⌘ + V for paste.
View Hidden Files on Finder
This is one of those hacks that I believe everyone would have. OS X Finder app displays all but those files that begin with a “.”. These files are generally hidden from the view. Hack to install mac os x sierra on older mac computer. However with this hack, you can view all the hidden files and folders on your Finder.
To turn this feature off, you can use the following command.
Disable the Warning while Emptying the Trash
Whenever you empty the contents in the Trash app, you are always prompted with a warning. If you are annoyed by this warning, you can switch these prompts with the following hack
You can undo this with the following hack
Disable Icons on the Desktop
Terminal For Hacking
You use the desktop to transfer some documents or media files on the fly. But this would mean cluttering your desktop with many icons. The following will allow you to hide these icons from the desktop view for a clean desktop yet the files can be found in the Finder app.
To view the icons back again, paste the following hack in the terminal.
Enable Text Selection within Quicklook feature
Terminal Hacks For Mac Os X
This is one of the killer hacks that I was craving for since Mountain Lion was announced. Quicklook is a great feature that lets you “peek” at the documents or media files without actually opening the files. You can get this Quicklook feature by the three-finger tap on any file you wish to preview. With this feature you can view PDF files, play audio and even video files.
One thing the Quicklook feature sorely lacks is the text selection. Normally while viewing documents, you cannot select the text withing Quicklook. This would have been handy when you want some important information on the fly. Thanks to this hack, we can now enable text selection right from Quicklook!
If, for some reason, you really do not want this feature, you can turn of this feature with this hack.
Terminal Hacks For Mac
Show the Path Bar in Finder
This is a handy feature when you wish to see where the current file is in your directories. To enable this feature, simple paste this hack and press enter.
You can turn this off via this hack.
There are many more hacks (22 in total) listed in the article. If you are the hacker type, you can head to the GitHub page for a comprehensive list of hacks that you can do on your OS X machine.
macOS is an intuitive operating system, so you don’t have to spend lot of time learning the basics; Knowing this, why should you learn and take advantage of the Unix command line available on your Mac? We have four good reasons:
- There are dozens of open source and freely available Unix-based apps. You don’t have to spend money on these.
- When you’re having difficulty searching for files in Spotlight, you can turn to Unix search tools. They’re way more powerful than Spotlight.
- You can manage files, folders, and file archives in an automated manner. Setting up a cron job will handle this automatically.
- It gives you more power and control over your system.
With so many Mac commands, it’s often difficult to remember and use them all. We’re here to help with a detailed cheat sheet of Mac Terminal commands you can use to unlock enhanced productivity on your system.
Launch the Terminal app from Applications > Utilities or search for it via Spotlight. Then you can get started with some of the powerful commands below.
Macbook Pro Terminal Commands
FREE DOWNLOAD: This cheat sheet is available as a downloadable PDF from our distribution partner, TradePub. You will have to complete a short form to access it for the first time only. Download The Mac Terminal Commands Cheat Sheet.
The Mac Terminal Commands Cheat Sheet
Command | Action |
---|---|
Shortcuts | |
Tab | Auto-complete file and folder names |
Ctrl + A | Go to the beginning of the line you're currently typing on |
Ctrl + E | Go to the end of the line you're 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 whatever you're running |
Ctrl + D | Exit the current shell |
Option + → | Move cursor one word forward |
Option + ← | Move cursor one word backward |
Ctrl + F | Move cursor one character forward |
Ctrl + B | Move cursor one character backward |
Ctrl + Y | Paste whatever was cut by the last command |
Ctrl + Z | Puts whatever you're running into a suspended background process |
Ctrl + _ | Undo the last command |
Basics | |
/ (Forward Slash) | Top level directory |
. (Single Period) | Current directory |
. (Double Period) | Parent directory |
~ (Tilde) | Home directory |
sudo [command] | Run command with the security privileges of the super user |
nano [file] | Opens the Terminal editor |
open [file] | Opens a file |
[command] -h | Get help about a command |
man [command] | Show the help manual of the command |
Change Directory | |
cd | Home directory |
cd [folder] | Change directory, e.g. cd Documents |
cd ~ | Home directory |
cd/ | Root of the drive |
cd - | Previous directory or folder you last browsed |
pwd | Show your working directory |
cd. | Move up to the parent directory |
cd./. | Move up two levels |
List Directory Contents | |
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 .(period) and .(double period) |
ls -1 | Output the list of files in one entry per line format |
ls -F | Display a / (slash) immediately after each path that is a directory, * (asterisk) 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 -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 |
File Size and Disk Space | |
du | List usage for each subdirectory and its contents |
du -sh [folder] | Human readable output of all files in a directory |
du -s | Display an entry for each specified file |
du -sk* | sort -nr | List files and folders, totaling the size including the subfolders. Replace sk* with sm* to list directories in MB |
df -h | Calculate your system's free disk space |
df -H | Calculate free disk space in powers of 1,000 (as opposed to 1,024) |
File and Directory Management | |
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 |
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 History | |
Ctrl + R | Search through previously used commands |
history n | Shows the previous commands you've typed. Add a number to limit to the last n items |
![value] | Execute the last command typed that starts with a value |
!! | Execute the last command typed |
Permissions | |
ls -ld | Display the default permission for a home directory |
ls -ld/<dir> | Display the read, write, and access permission of a particular folder |
chmod 755 <file> | Change the permission of a file to 755 |
chmod -R 600 <dir> | Change the permission of a folder (and its contents) to 600 |
chown <user>:<group> <file> | Change the ownership of a file to user and group. Add -R to include folder contents |
Processes | |
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 |
ps -ax | grep <appname> | Find a process by name or PID |
Network | |
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> |
Homebrew | |
brew doctor | Check brew for potential problems |
brew install <formula> | Install a formula |
brew uninstall <formula> | Uninstall a formula |
brew list | List all the installed formulas |
brew search | Display available formulas for brewing |
brew upgrade | Upgrade all outdated and unpinned brews |
brew update | Fetch latest version of homebrew and formula |
brew cleanup | Remove older version of installed formula |
brew tap homebrew/cask | Tap the cask repository from GitHub |
brew cask list | List all installed casks |
brew cask install <cask> | Install the given cask |
brew cask uninstall <cask> | Uninstall the given cask |
Search | |
find <dir> -name <'file'> | Find all files named <file> inside <dir>. Use wildcards (*) to search for parts of filenames |
grep '<text>' <file> | Output all occurrences of <text> inside <file> (add -i for case insensitivity) |
grep -rl '<text>' <dir> | Search for all files containing <text> inside <dir> |
Output | |
cat <file> | Output the content of <file> |
less <file> | Output the contents of <file> using the less command that supports pagination and more |
head <file> | Output the first 10 lines of <file> |
<cmd> > > <file> | Appends the output of <cmd> to <file> |
<cmd> > <file> | Direct the output of <cmd> into <file> |
<cmd1> | <cmd2> | Direct the output of <cmd1> to <cmd2> |
Next, Customize the Terminal
There are lot of commands in this cheat sheet. But you don’t have to learn all of them at once! Pick a few that integrate well with your workflow and save you the most time. Once you’ve mastered these commands, there’s still more to learn about the Terminal to enhance your experience with it.
Advertisement
Best Mac Terminal Hacks
For further reading, we’ve looked at how to customize the Mac Terminal and make it more useful How to Customize the Mac Terminal and Make It More UsefulThe Terminal app on your Mac is powerful, but it's a bit bland out of the box. Here's how to personalize Terminal for your needs. Read More .