ls -F
[file…]List your files (in columns)
ls -l
[file…]List your files (in detail).
ls -alAlso list all the hidden files (those whose names start with a period).
cp
oldname
newcopyCopy a file.
mv oldname
newnameRename or move a file.
At any given time, you will be located in some current working directory. When you first log in, this will be your account's home directory. You can create subdirectories under that, so you can keep files for different projects separate. You can create subdirectories within subdirectories, and so on to any depth.
You will also need to know how to use directories so that you can use files located under other users' accounts.
A pathname is a description of a file's location somewhere in the Unix directory structure.
Most file and path names are assumed to be in the current working directory. Slashes (“/”) are used to denote subdirectories, so for example this pathname
bill/cat
refers to file cat in
directory bill under the current
working directory.
Pathnames that start with a tilde character “~” are relative to your home directory. For example,
~/foo
refers to file foo in your
home directory.
Pathnames that start with “~”a tilde followed by another user's name are relative to that user's home directory (assuming that you have permission to see into that directory). For example,
~moriarty/bar/klarn
refers to file klarn in
directory bar
under user moriarty's home
directory.
You can refer to the parent directory by using two dots (“..”), so pathname
../ack
refers to file
ack in the directory above the
current working directory. Similarly, the
pathname
../../letters/susie
refers
to file susie in subdirectory
letters under the directory two
levels above the current working
directory.
Pathnames starting with a slash
(“/”/) are called absolute
pathnames. Your home directory will
typically be located at absolute path
/u/,
where yourname
is your account (login) name. (The path reported by
the yournamepwd command may be
different, but that's an artifact of our local
software.)
Commands for working with directories:
cd
pathnameChange the current working directory.
pwdShow the pathname of the current working directory.
mv
file…Move the given files to a different directory.
mkdir
pathCreate a new directory.
rmdir
pathRemove an empty directory.
ln -s oldfile
newnameMake
a symbolic link to
newname.oldfile
The first line of defense against others tampering with your files is proper user authentication. Don't tell anyone your password, and don't write it down. To change your password, use this command:
passwd
Also, always log out when you are finished. From an X window session, move the mouse to the background, press and hold the right button, and select .
You can control whether others can see or change your files. This is done by setting permissions on a file-by-file basis. There are three kinds of permissions:
If someone has read permission for a file, that means they can see its contents.
Write permission is the power to change or delete a file.
Execute permission applies to programs and commands—the ability to execute a file as a program or command. (Execute permission for a directory grants the right to see what files are there.)
To find out the permissions for a file, use this command:
ls -l [file]…
In the output from this command, the first ten characters show you the file type and permissions.
The first character is
“-” for
an ordinary file,
“d” for a
directory, or
“l” for a
symbolic link.
The next three characters specify the read
(“r”),
write (“w”), and execute
(“x”)
permissions for the file's owner. A hyphen
(“-”)
means no permission.
The next three characters specify the read,
write, and execute permissions for group members.
Groups are a mechanism for allowing file access to a
specific list of people; if you need to set up this
kind of access, e-mail a request to
tcc-eng@nmt.edu.
The next three characters specify the read, write, and execute permissions for the “world” (all other users).
The command to change permissions is:
chmodwho=valuefile…
where:
whois
to set the owner's permissions,
u
to set group permissions,
g
to set world (“other”) permissions, and
o
to set all three at once.a
valuecan be up to three of the letters
for read permissions,
r
for write permissions, and
w
for execute permissions.x
file…is a list of files whose permissions are to be changed.
To remove permissions, use:
chmodwho-valuefile…
And to add permissions:
chmodwho+valuefile…