DirectNET

Data Center Management Solutions including UPS Systems, Data Center Cooling, KVM over IP & IP Power Strips, Server Racks and Server Rack accessories; KVM Switches and KVM Extenders; Rackmount Monitors and Rackmount Keyboards.


NAVIGATION
Home
Store
INSIDE MAC
Television Shows
Broadcast Shows
Daily News Shows
Special Shows
EVENTS
DAILY TIPS
Design
Mac OS X
Mac OS X UNIX
COMMUNITY
Surveys
NEWS
Current
Press
Archive
FEATURES
Editorial
Dr. Mac
Reviews
Reader Reports
RESOURCES
FAQ
Documentation
Learning Center
MAN pages
Glossary
Tutorials
Tips
Links

OUR PARTNERS

OSXFAQ Mac OS X UNIX Tip-of-the-Day   back to index

Week 101 - Unix Commands Reference (7 March 2005)

by Adrian Mayo - Editor, OSXFAQ

Monday - Basic File and Directory Commands

The next four weeks will form a Unix command reference by listing lots of commands under specific areas of usage. There are so many commands available that it is impossible to know them all, or even remember all those one knew and used just last month.

See the rest of the tips for lots of example usage of these commands.

See the Learning Centre for tutorials on these commands, and explanations of Unix permissions.

And of course, don't forget the Unix manual 'man'.

ls ... list the contents of the current directory
Option -l (ell) to list with details
Option -a to list hidden dot files, -A to miss out '.' and '..'
Option -L to follow symbolic links
Option -F to identify different types of files, or
Option -G to identify with colour
(See tips week 24)

cp ... copy files and directories
Option -R for recursive copy to copy whole directory subtrees

mv ... move or rename files and directories
Rename a file, move it to another directory, or do both at the same time

rm ... delete files and directories
Option -R or -r to recursively move whole directory subtrees
Option -f to override permissions where possible
Option -i for interactive confirmation of each deletion

cd ... change current directory
'cd..' to move up a directory
'cd' to move to your home directory
'cd -' to move back to the last directory

pwd ... print working directory
Display the current directory

pushd ... change directory and stack it Each time pushd is issued, the current directory is remembered on the directory stack Use popd to retrace your steps

popd ... move back to the last pushed directory 'pushd' and 'popd' work on a stack system where the last directory pushed is the first to be popped

dirs ... print the directory stack
This is the stack is written by 'pushd' and read by 'popd'

(See tips weeks 30 and 32)

mkdir ... create a new directory
Option -p to make many (nested) directories in one go

rmdir ... delete a directory
The directory must be empty
Use 'rm -r' to delete non-empty directories

chmod ... change file and directory permissions
Option -R to change permissions in a whole directory subtree
Option -L to follow symbolic links
Option -h to change the mode of a link instead of the file it points to

chown ... change owners of files and directories
Options -R, -L, and -h as for 'chmod'
Change both user and group owners by specifying user-owner:group-owner

chgrp ... change group owner of files and directories
Options -R, -L, and -h as for for 'chmod'

chflags ... change the file flags
Unix files and directories have many flags such as immutable, append-only, archived, that can be set using this command
Options -R and -L as for for 'chmod'


Discuss this trick in the Learning Center forum


If you want to learn more about Mac OS X Unix visit the Learning Center  click.

  • For beginners: Mac OS X Unix Tutorials
  • For detailed information on specific topics: Advanced Unix
  • For OS X in gereral: Mac OS X Tutorials

Copyright © 2000-2010 Inside Mac Media, Inc. All rights reserved.
Apple assumes no responsibility with regard to the selection, performance, or use of the products or services. All understandings, agreements, or warranties, if any, take place directly between the vendors and prospective users.
Apple, the Apple logo, Mac, PowerMac G4, PowerMac G5, Xserve, Xserve RAID, PowerBook, iBook, Airport, AirPort Extreme, iMac, eMac, iLife, iMovie, iCal, iPhoto, iTunes, QuickTime, FireWire, iPod, iSight, AppleWorks, Macintosh, Jaguar, Panther, Mac OS, Mac OS X and Mac OS X Server are trademarks of Apple Computer, Inc.