AMITIAE - Monday 1 October 2012
Command Line Work: New Users and Terminal (8) -- File Commands and More |
|
By Graham K. Rogers
With the installation of wget I had to resort to some utilities that most Mac users will be unaware of: sudo, mkdir, mv; and I also reminded myself of cp (superuser, make directory, move and copy). The installation of wget from files that were last updated a few years ago, needed me to create directories inside directories that already existed and then move the files to those locations. Some locations can only be used by the Root user. By default OS X has no password for this. While some may argue that giving Root a password is not a problem, I would advise against this. In several years of OS X use, the only time I have needed to execute Root commands, sudo allowed sufficient acccess for the task. This command allows a permitted user to execute a command as the superuser (or execution of a command as another user). The sudo command can only be used in an Admin account, so for this (and a couple of other similar installations), I had drag the files into the Dropbox in the user's Public folder and switch accounts. Working in Terminal in that Admin account, I had to create three directories. One was a directory called etc in the /usr/local folder. As I prefer working in the specific directory for this type of job rather than entering a path, I typed in the command to switch to the specific directory I needed, cd /usr/local
mkdir etc As the permissions here (the /usr/local folder) are limited, I also needed the sudo command, so the full entry was sudo mkdir etc
That file was in the Downloads folder. After typing in the command, sudo mv I clicked on that file in the Finder and dragged it to the command line: this creates the correct path to the file. I added the new location to the end of the text line (note the 3 spaces here -- between each component of the command): sudo mv /Users/graham/Downloads/wget/wgetrc /usr/local/etc
cp filename1 filename2 The duplicate was alongside the original in the folder.
The commands outlined here all have manual entries which may be examined using the man command followed by a space, then the command name (man sudo, man mkdir, man mv and man cp).
Graham K. Rogers teaches at the Faculty of Engineering, Mahidol University in Thailand. He wrote in the Bangkok Post, Database supplement on IT subjects. For the last seven years of Database he wrote a column on Apple and Macs. |
|
For further information, e-mail to