1/29/2024 0 Comments Mac open terminal shortcutThe current working directory is often included as part of the command prompt. When a Terminal is launched, it sets the initial working directory to the home directory of the current login user (denoted as " ~"). To display the current directory, issue command " pwd" (print working directory): // Print Current Working Directory pwd All relative pathnames/filenames are relative to the current working directory. The Terminal session maintains a so-called current working directory. Print Current Working Directory " pwd" Command In this article, I shall denote the command prompt simply as " $". For example, enter " pwd" to print the current working directory: $ pwd You can enter commands after the command prompt. In Linux/Ubuntu: " ComputerName: CurrentDirectory$".In macOS: " ComputerName: CurrentDirectory Username$".Drag the "Terminal" to your Launcher since you need to use it frequently.Ī Terminal displays a command prompt ending with a " $" sign, in the form of: In Ubuntu: Open "Dash" ⇒ type "Terminal" or choose "Applications" lens ⇒ Installed ⇒ Select "Terminal".Drag the "Terminal" to your dock since you need to use it frequently. In macOS: Open "Finder" ⇒ Go ⇒ Utilities ⇒ Select "Terminal".By default, the Terminal in Ubuntu and macOS runs the so-called bash shell, which supports a set of commands and utilities and has its own programming language for writing shell scripts. The Terminal application is a command-line Interface (or shell). This is because command-line inerface is much more powerful and flexible than the graphical user interface. Programmers use a command-line interface (CLI) to issue text-commands to the Operating System (OS), instead of clicking on a Graphical User Interface (GUI). Unix/macOS system is case sensitive, a rose is NOT a Rose, and is NOT a ROSE. For example, if the current working directory is " /usr/lib/jvm/", then the relative pathname " jdk1.7.0_07/bin/" refers to " /usr/lib/jvm/jdk1.7.0_07/bin/". A relative path does NOT begin with " /" or " ~". Relative Pathname: A relative path is relative to the so-called current working directory.For example, " ~/Downloads/jdk/" is the same as " /Users//Downloads/jdk/" in macOS. That is, it starts with a " /" followed by all the sub-directories, separated with " /" leading to the file, e.g., " /usr/lib/jvm/jdk1.7.0_07/bin/".Īn absolute path can also begin with the current user's home directory (starts with "~"). Absolute Pathname: An absolute path begins from the root directory.The pathname can be specified in two ways: For example, in " /usr/lib/jvm/jdk1.7.0_07/bin/javac", the pathname is " /usr/lib/jvm/jdk1.7.0_07/bin/" and the filename is " javac". To reference a file, you need to provide the pathname (directory and sub-directories names) and the filename. In other words, ~/Downloads is the same as /Users//Downloads. You can use a special notation " ~" to denote your home directory. Their full filenames are /Users//Downloads, /Users//Documents, respectively. Your home directory ( /Users/) contains sub-directories such as Downloads, Documents. Users/peter, /Users/paul in macOS or /home/peter, /home/paul in Ubuntu. The users' home directories are allocated under /Users (for macOS), or /home (for Ubuntu), with a sub-directory name the same as the username, e.g. Each user on the system is allocated a directory for storing his files, known as home directory. Unix is a multi-user operating system (although most of you, in particular the Mac users, use it as a single-user personal computer). Notes: Windows use " \" (back slash) as the directory separator, and may contain multiple root directories - one for each drive (e.g., c:\, d:\). Hard drives are mounted somewhere under the root directory. There is only one root directory for the entire Unix/macOS's file system. The sub-directories are also separated by a " /". The leading " /" (forward slash) denotes the root directory. Root Directory ( /)Ī file is identified via the directories and filename, e.g., " /usr/lib/jvm/jdk1.7.0_07/bin/javac". A sub-directory may contain sub-sub-directories and files. A directory may contain sub-directories and files. The directories are organized in a hierarchical tree structure, starting from the root directory. Files are organized in directories (aka folders).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |