Continuing from the previous post on.
RENAMING FILES & FOLDERS
The way files/folders are renamed is by using the mv command. In the mv command make sure that the destination folder is the same as the source folder for your target, its just the target name that changes.
So if we have a folder called Documents & inside it we have a folder called Files. To rename Files to OfficeFiles we run the following command.
mv Files OfficeFiles
Top modify the basic UNIX or POSIX permissions on a Mac we need to use the chmod command. The standard permissions apply to Users, Group & Everyone else. Each of these entities has 3 flags assigned to it: rwx Read-Write-Execute. Each flag is a boolean flag holding either true or false, indicated by 1 or 0.
So for example if we wanted to modify the permissions of the OfficeFiles folder to be read-write only for the user & read only for group & everyone else then the command would need the following information.
User: rwx = 110 -> 6
Group: rwx = 000 -> 0
Everyone else: rwx = 000 -> 0
So the command would look like: chmod 600 OfficeFiles
FOLDER PATHS & NAVIGATING FOLDERS
A good understanding of the folder structure within a Mac is necessary while dealing with terminal commands.
All folders with the Mac begin at root indicated by ‘/’
Root contains the following folders
As you can see from the screenshots, the terminal shows more folders than are visible through finder.
Within the Users folder all the Home Folders for the different users on the machine are listed. Again, users typically have access only to their own login folder.
Each users Home Folder contains the following Folders
Depending on your usage you may see a different view from the one shown below.
The following are some examples of navigating the File System.
1)Accessing the root folder
2)Accessing the home folder. Example home folder called admin
cd /Users/<home folder name>
or cd ~/
NOTE: the ‘~/’ is a shortcut for accessing the home folder directly. Using the shortcut access will only be given to the home folder for the user currently logged in.
3)To access the OfficeFiles folder
There are a number of built in editors available within the Mac. Apart from TextEdit, which is a GUI based editor, there are many editors available for direct use from the terminal too.
Emacs is a basic text editor that is built into the mac. There are various versions available but those may not be built in. You may need to download them manually.
Here are some common emacs commands to perform operations. For an even bigger list visit http://www.cse.iitb.ac.in/~br/courses/cs699-autumn2013/refs/emacs-commands2.html
This is yet another editor that is built into most UNIX like OS. This is the editor that is used when running the less or more commands.
Here are some common commands used in Vi.
Apart from this there are other editors such as gedit & xemacs which has a GUI interface.
NETWORKING RELATED TERMINAL COMMANDS
Used to test connectivity to a particular IP address
Used to check the hop trace between your machine & destination
Used to get network interface related information
ipconfig getoption en1 <option>
There is a lot more information that can be gleaned using ipconfig. For a full list run the man command for ipconfig
Used to configure ifnormation related to network interface
ifconfig en0 inet <ip address> netmask <subnet mask>
There are different ways to get the forward & reverse lookup to happen
nslookup <domain name>
nslookup <ip address>
dig <domain name>
dig -x <ip address>
NOTE: Please use the man command to get more information.