
By default, the process will display all processes by CPU usage, with the process id or PID displayed alongside each entry. To see a list of currently running processes and how much CPU and memory they’re currently using, execute top. ace () Prints a stack trace at the moment the function is called. console.timeEnd ( name) Stops the timer associated with the given name and prints the elapsed time to the console. Useful for timing the duration of segments of code.

Many of the shortcuts that you use in other apps will work here. Starts a timer associated with the given name. Launch Terminal by finding it in the Utilities folder or by searching for it using Spotlight, and then familiarize yourself with the interface.

This is how you execute commands on your Mac using the command line. This is especially useful for printing a path that you can later copy and paste. Your Mac comes with an app called Terminal under Applications > Utilities. To display the current directory that you’re in (or “print working directory”), you can use the pwd command. If you want to edit a system file, for example, you might need to use sudo nano in order to save your changes. Some commands require root access in order to work.
How to view mac console commands password#
Once you’ve entered a command prefixed by sudo, you’ll be required to enter your administrator password to execute it. If successful, you will see a login prompt at the command line, as if you just booted up a unix environment without a windowing environment, now enter a user name. The sudo prefix is used to execute a command as a “super user,” also known as root or admin. For username, type the following and then hit return no password is necessary yet. Display the weather, shut down your computer, and more, all from your terminal. To save a file, hit Control+O (known as “Write Out”) or quit without saving using Control+X. Impress Your Friends With These Fun and Useful Mac Terminal Commands. Once you’re in nano, pay attention to the commands at the bottom of the screen, which involve the control key. Use cp to initiate the copy command, add a flag where required, and then enter the target file or folder, followed by a space, and then add the destination folder. Remember, you can also use the same location shortcuts that you’d use with the cd command (e.g. So, to learn more about a command type man name of command, where 'command' is the name of the command. For example, use -C to get a multi-column output, -S to sort by size, -lt to sort by date modified, -la for detailed contents including hidden files, or -lh to create a list with readable file sizes. To see a list of all the commands available in Terminal, hold down the Escape key and then press y when you see a question asking if you want to see all the possibilities.

You can add flags to the ls command to get different results. Append it with a location on the drive to specifically target that directory. List Files & Folders: lsĪlso useful in navigating your drive, ls can be used to list the contents of the current directory simply by executing the command. For example, running cd ~ will take you to the Home directory for the current user. You can also use cd/ to get to the root of the drive, cd. You can use shortcuts to quickly skip to certain directories.
