Prints out name of directory that contains a file. Prints out file part of a file path basename command in general can be written as basename path In the below picture, basename /Users/gagan/Desktop/Folder1/file1.txt command prints out file1.txt dirname – Directory Operation Command pwd command in general can be written as only pwd In the below picture, pwd command prints out /Users/gagan which is current working directory. Prints out name of current working directory. cd command in general can be written as cd In the below picture, cd command changes current directory from being gagan to root directory ~ pwd – Directory Operation Command Prints out name of directory that contains a fileĭeletes a non-empty directory and all of content(either files or directories) in itĬhange the current working directory.
Prints out name of current working directory These are commands which can be used for dealing with Directories in Mac FileSystem. Anyway let’s get into what Directory Operations can be used in Mac Terminal.
That’s why every beginner in Software Engineering should be aware about What is Terminal, How does it works and what are commands which can be used in it? Also if in case you already don’t know what is terminal then check out this article – What is Terminal in MAC OS?. Moreover, Terminal can be used for compiling/executing multiple files in a large Software Engineering Project. Like you can build a Django Framework based website just from Terminal. That’s why these can be really useful, moreover terminal commands can be used for building programming projects as well. These can be used for creating files/directories or checking status of processes being run by the Operating System.
Terminal is an application that runs commands given by user, actually there is a special program inside Terminal called Shell – which reads in commands and execute them on Mac OS operating system.Terminal’s only job is to open windows and manage shells, while shells actually do real work of Command Execution. You can enter commands in Terminal and then Shell Program running inside terminal will execute those commands.Ĭommands are a kind of way to interact with Operating System and File System.