How To Change Directory To A Folder In Terminal
If y'all've been using a Mac for whatever length of time, y'all know that it's more than merely a pretty point-and-click, window-and-icon interface. Beneath the surface of the operating system is an entire world that yous tin admission just from the command line. Terminal (in your /Applications/Utilities folder) is the default gateway to that command line on a Mac. With it, instead of pointing and clicking, you type your commands and your Mac does your behest.
Why would you want to exercise that? For almost all of your calculating needs, the regular graphical user interface is enough. But the command line can exist handy when it comes to troubleshooting your Mac, to turn on "hidden" settings, and other advanced chores. It's a good idea for anyone who isn't an utter beginner to be familiar with information technology.
If y'all aren't already familiar with your Mac's command-line interface. Beginning up: How to navigate the file organisation from the command-line prompt.
The prompt
Past default, when you open up Terminal, the get-go matter you'll run into is something similar this:
Last login: Friday Jun 25 ten:37:06 on ttys000
romansempire@Mac-Pro-8 ~ %
Here's what you're seeing:
- The first line shows the concluding fourth dimension you logged into your Mac via the command line; that's the current time, when you lot're using Terminal.
- The second line is the prompt, and while it can modify from arrangement to organization depending on configuration, by default information technology contains several bits of information:
- In the prompt in a higher place romansempire is the user proper name.
- Mac-Pro-8 is the proper noun of the Mac (same equally the Reckoner Name in the Sharing pane of Organization Preferences).
- The ~ shows where you are in the file system of the Mac. ~ is a shortcut that means the current user's Home folder. (In the Finder, that'southward the folder with your user name and the business firm icon.)
- The % is a character that the trounce (the default interface that Terminal uses) displays to indicate that it'due south set to have a command.
How to run into what'due south in a binder
When you commencement go to the command line, you're in your home binder. While yous're there—or when you're in any folder (directory in Unix-speak)—yous might want to know what's in it. To exercise that you apply the ls
(or list) command. Blazon ls
and printing the Render key, and you'll run across the folders (and/or files) in the current directory.
IDG
The output of the patently ls
control is pretty thin; information technology shows you the names of files and folders contained in the current directory (including some familiar ones such as Movies, Music, Pictures, then on). Fortunately, y'all tin add a number of optional switches to the ls
command that allow you to see more information. For case, type ls -l
(that's a lower-case L), then press Return. You'll see something like this:
IDG
Don't worry also much well-nigh what all that means right now—we're simply getting our anxiety wet. The indicate is that ls
can provide additional information most files and folders, depending on the options you specify. In this case, that additional information includes the name of the user who owns each item in the directory. (That buying is part of the Unix system's file-permissions regime.) The romansempire staff
side by side to about of those items above means that each one is owned by the user romansempire, who is in the group staff. The other understandable bit of data next to each file and folder is the engagement and fourth dimension each one was last modified.
1 other handy pick: You lot can view invisible files—ones that the Finder doesn't normally show you—past typing ls -a
. (These hidden files all have dots (.) in front of their names.)
IDG
How to admission other folders/directories
When you're in the Finder and yous desire to move to some other folder, you lot find that binder and double-click it. From the command line, you use the cd
(or alter directory) control instead. Then let's say you're in your Home folder and want to peek inside the Downloads folder. To practise that, you'd type cd Downloads
. (Remember to always type a infinite after whatsoever control that has an additional argument, such as the name of a directory in the previous example.) Once you've done that, ls
will show you the contents of your Downloads binder.
Here are a couple of quick tricks for moving effectually in your Mac'southward file system.
- If you type
cd
and press the Return fundamental—with no directory specified—you'll go back to your Home folder. (Y'all tin also typecd ~
to get there.) - If yous type
cd /
, you'll go to the root level of your startup disk. - If yous type
cd ..
(that's two periods), yous'll go to the directory in a higher place the i you lot're currently in. Then if you're in your habitation folder, and typecd ..
, you'll go to your Mac's /Users folder. - And if you type
cd -
(hyphen) you lot'll become back to the directory y'all were in before the terminal time you issued thecd
command.
To acquire more Terminal commands, see our articles on how to copy and motion folders every bit well as delete files and folders using the command line and get assist when you lot need it from man pages.
Note: When you buy something after clicking links in our articles, we may earn a small committee. Read our affiliate link policy for more than details.
Source: https://www.macworld.com/article/221277/command-line-navigating-files-folders-mac-terminal.html
Posted by: registerguried.blogspot.com
0 Response to "How To Change Directory To A Folder In Terminal"
Post a Comment