Some Basic UNIX Commands

Getting Around Your Directory Structure

Print working directory. Shows what current directory you are in.
Lists the contents of your current directory
ls /subdirectory
Lists the contents of the subdirectory you specify.


web2:/u1/home/sclaus$ ls






ls -la
Lists all files in the current directory, showing detailed information such as file sizes, ownership, last modified date, and permissions.


web2:/u1/home/sclaus$ ls -la

8 sclaus
99 root
1 sclaus
1 sclaus
1 sclaus
1 sclaus
1 sclaus
1 sclaus
1 sclaus
1 sclaus
1 sclaus
2 sclaus
1 sclaus
8 sclaus
1 sclaus
2 root
2 sclaus
1 sclaus
25 sclaus
1024 Oct8 19:54 ./
2048 Oct8 15:29 ../
906 May 24 08:08 .addressbook
3653 May 24 08:08
4946 Oct9 05:49 .bash_history
163 Apr 121999 .kermrc
34 Apr 121999 .less
114 Apr 121999 .lessrc
10210 Oct8 19:53 .pinerc
37 Apr 121999 .profile
46 May 24 08:08 .signature
1024 Apr 121999 .term/
415 Sep 26 17:34 dead.letter
1024 Apr 121999 ftp/
5902 May7 19:15 index.html
1024 Oct1 00:10 logs/
1024 Oct8 19:54 mail/
7450 May 13 16:17 news.html
2048 Oct 11 00:00 public_html/

Understanding the Listing

The first character above shows the file type (d indicates it is a directory, - is a file) and the rest of the column shows the permissions.

The second column shows who owns the file. In this case, our user, sclaus, is the owner of most files.

The third and fourth show the file's last modification date, size, and file name.

Understanding Permissions
Going back to the first column of the listing as shown above, we get detailed information on the file's particular permissions. The 9 characters following the d or - represent the following:

The first three characters represent permissions for that file for the owner.
The second three characters represent permissions for that file for the group.
The third three are for the world.

What The Codes Mean

r - read
w - write
x - execute

In the following example, we can find out what permission is of the file,


The character - indicates that the permission in that place is off. The very first character states whether or not the file is a directory. Since our above example is a file, and not a directory, it is turned off, represented by -.

The first group of three characters is for the owner permissions. rw- indicates the owner can read and write that file. But since there is a - in the execute position, this indicates that the excute permission is off, therefore the owner cannot execute it.

The second group of three represents permissions for your group. Like the owner permissions, the group can read and write to this file.

The last group shows the rest of the world's permissions, and in this case, it is read only since the write and execute permissions are off (-).

Changing Permissions (chmod)
You may change the permissions by using the chmod command.

Syntax: chmod who[opcode]permission filename

When using the command, you must tell the system who you want to change permissions for.

  • u = user
  • g = group
  • o = other
  • a = all (default

Op Codes
This tells either to add or remove permissions.

  • + = add permission
  • - = Remove permission


  • r - read
  • w - write
  • x - execute

Let's take a look at the line for news.html.

-rw-rw-r--   1sclaus  users  7450 May 13 16:17 news.html

Using the above, let's say that you wish to change the permissions so that the world (the third set of characters which has the values r--) to be able to do more than just read the file; let's change the permissions on this file so that the world can also write to it.

The proper syntax would be:

chmod o+w news.html

Breakdown: chmod is the command, o is who it applies to, + is to add permission, and w is write.

Using Numerical Commands
UNIX has many different ways of doing things, and there is an alternative method to chmod files using numbers instead. Here's how it works. Each trio of values has a numerical value assigned to it.

  • r = 4
  • w = 2
  • x = 1

Let's look at our example file again:

-rw-rw-r--  1sclaus  users 7450 May 13 16:17 news.html

The first character is a -, but that particular place states whether or not the file is a directory, as we talked about above. Move to the next character.

The next character's place is worth 4, and there is a 4 there. The place after that has a value of 2, and we do have a 2. The third place has the value of 1, and it is off, indicated by the -, which is a value of 0.

Add the three values, 4 + 2 and you have a value of 6. Make note of the 6.

The next trio of values are also rw-. The r has a value of 4, the w a value of 2 and x is off, so that has a value of 0. Make note of this second value as 6.

The third, r--, has the first value of 4, and 0 values for w and x, so this third value is 4.

So, the numerical equivalent of the command chmod o+w news.html is chmod 664 news.html.

-rwxr-xr-x breaks down as follows:

- r     w    x
4 + 2 + 1 = 7
r     -     x
4 + 0 + 1 = 5
r     -     x
4 + 0 + 1 = 5

Therefore, -rwxr-xr-x is equivalent to 755.

To create this condition, type chmod 755 filename.

More Commands to Help You Get Around

cd subdirectoryname
Change directory. Moves you to the subdirectory you specify.

cd ..
Change directory. The .. takes you up one directory level.

Other Commands

Print disk usage. If you type du from your public_html directory, it will give you the size of each file and sub-directory, then gives you the total for everything at the bottom. That is the storage that is checked for additional charges.

Shows the amount of free disk space available on all mounted file systems.

Makes a directory (a subdirectory within your current working directory).

Transfers files to and from a remote network site.

Copy command. You might want to copy a file and give it a new name.
Example: cp file1 newfilename
This takes file1 and makes a copy of it called newfilename.

Remove. Removes (deletes) the file you specify.

Remove directory. Removes (deletes) the directory you specify. Note: You cannot delete a directory that still has files or subdirectories in it.

Moves or renames files and directories.
Example: mv oldname newname
or: mv oldname subdirectory/newname

Note: Unlike the copy command, the mv command will delete the old file (the one you are moving).

Defining Files with Wildcard Characters

Wildcard characters can be used to represent many other characters. Use them whenever you need to define a string of characters, such as a file name with the use of a command.

  • * matches any string of characters
  • ? matches any single character
  • b* gets all files that start with b.
  • b?s*jpg gets all .jpg files that start with b and have a third character of s.
  • *.htm* would get all HTML files, whether they were .htm or .html.

Text Editors

There are several editors available for you to use with your shell account: joe, pico, vi and emacs. If you are unfamiliar with using text editors, it is advisable to start with pico. It is the most user-friendly editor, with the commands shown at the bottom of the screen to help you along.

Tin: Shell-Based News Reader

Tin allows you to view, subscribe to, and read your newsgroups via your shell account. Launch Tin by typing tin at your command prompt. Once the program has launched, type h for an extensive help section which will get you started using Tin.

Sending and Receiving E-Mail with Pine

Pine is a menu-driven program which will allow you to receive and send e-mail from your domain via a telnet window. Click here to read up on how to get started with Pine.

Why Us?


Follow Us


All Rights Reserved
© Copyright 2017

Customer Support   855-TDL-HOST (855-835-4678)    -     TDL Solutions    -    Webmail