MAC TERMINAL COMMANDS CHEAT SHEET FULL
Shows information about memory usage and swap.įile Commands Listing the contents of the current directory lsĭisplays the contents of the current directory.įormat the output as a list with a more detailed view of the contents of the current directory.ĭisplays the detailed list with all the contents of the current directory.ĭisplays the full path to the current directory.ĭisplaying the file content on the screen cat /some/file/pathĭisplays the content of the file /some/file/path. Terminal commands mac cheat sheet print out full# You can redirect the output not to the screen, but to another file, using the symbol '>'. If you want to limit the output to a certain number of lines, use the -n option.Īlso, the cat command can be used to view specific system information, for example:ĭisplays the content of the file /some/file/path page by page. Go to the next page with Space barĪ more advanced variation of the command more, which also paginates the contents of the file filename, but adds the ability to scroll in both directions, search for content, etc.ĭisplays the first 5 lines of the file filename.ĭisplays the last 10 lines of the file /some/log/path, adding new lines as they appear in the file ( -f option). Tail -f /some/log/path | grep -i -P "(error|warning)"ĭisplays those lines from the last 10 lines of the file /some/log/path, that contain error or warning. Goes to the home directory of the current user. Goes to the directory one level up from the current directory (parent directory).Ĭreating files and directories touch filenameįor the file named filename changes the date and time it was created to 00:00. Terminal commands mac cheat sheet print out full#.Terminal commands mac cheat sheet print out manual#.