Edit History Actions Discussion

Diff for "Howto/FileManagement"

Differences between revisions 3 and 4
Revision 3 as of 2007-11-06 06:40:58
Size: 9029
Editor: tommsmith
Comment: Content Added(bushblows)
Revision 4 as of 2007-11-06 18:35:31
Size: 10815
Comment: Sizes
Deletions are marked like this. Additions are marked like this.
Line 92: Line 92:
| | | | | | | | | | |-File name
| | | | | | | | | |-Time created/modified
| | | | | | | | |-Date created/modified
| | | | | | | |-Size of file
| | | | | | |-Group the file is in
| | | | | |-Owner's username
| | | | |-Number of directories
| | | |
-Other permissions
| | |-Group permissions
| |-Owner permissions
|-File type}}}
| | | | | | | | | | \-File name
| | | | | | | | | \-Time created/modified
| | | | | | | | \-Date created/modified
| | | | | | | \-Size of file
| | | | | | \-Group the file is in
| | | | | \-Owner's username
| | | | \-Number of hard links (or files in directories)
| | | \
-Other permissions
| | \-Group permissions
| \-Owner permissions
\-File type}}}
Line 163: Line 163:
==== Changing Permissions(Cont...) ====

We can also change permission of user, group, others with one command. We will get into this now. We will be changing permissions of files with numbers.
==== Changing Permissions (Numeric) ====

We can also change permission of user, group, others using numbers. This might be used in other howtos and similar on the Internet so it's good to know, but it's not really ''needed'' to manage files. We will get into this now. We will be changing permissions of files with numbers.
Line 190: Line 190:
ls -lh

quota

du -hs
When you list files with `ls -l` you will get the filesize. However, since this filesize is displayed in only bytes (no prefixes) it can be hard to get a good sense of how large files are. To help us read the output we can use the flag `-h` which stands for ''human readable''. This will make the filesizes display with prefixes like KB or MB which is much easier to read.

{{{ls -lh
-rw-r--r-- 1 independence shelluser 851K 2007-10-09 16:02 latest.tar.gz}}}

You can see the filesize here is 815K (KB or KiB really), which is much easier to read than something like 870766.

To view the size of a whole directory tree, we can use the command `du`. This will display the sizes of all directories below and including the working directory. To get some nice prefixes again, use the flag `-h`:

{{{du -h irclogs/Allshells
3.5M Allshells/}}}

To view your total disk usage and quotas use the command `quota`:

{{{quota

Disk quotas for user independence (uid 1000):
     Filesystem blocks quota limit grace files quota limit grace
      /dev/hdv1 56868 0 512000 1054 0 0
      /dev/hdv2 59124 0 512000 1185 0 0
      /dev/hdv3 7308 0 25600 710 0 0}}}

You see your quotas for each mount-point or partition here. `hdv2` is your home directory and `hdv3` is www (everything in public_html.)

`blocks` are the space you are currently using (in KiB), and `limit` is your hard quota limit. You can also see the number of files you have.

I'm using 59124 KiB of 512 KiB in my home directory for example.

File Management

This is work in progress, not complete. Please help and add more stuff!

This is a howto explaining how to manage files on a UNIX system. This is very important to get the most out of your shell account.

Basics

The very basics of file management is how to list, create, copy, move and delete files and directories. To create a file, you can open up a text editor, write some text, and then save it. To do this with nano, type:

{{{nano myfile.txt }}}

This will open up the text editor nano. Write some text and press ctrl-x to exit, nano will then ask if you want to save the file. You can also use ctrl-o to just save the file, without exiting nano.

You can also use this command to just create a new empty file:

{{{touch newfile }}}

To create a new directory, use this command:

{{{mkdir mydir }}}

To see your newly created files and directories, use the command ls: