Size: 9029
Comment: Content Added(bushblows)
|
Size: 11623
Comment: converted to 1.6 markup
|
Deletions are marked like this. | Additions are marked like this. |
Line 4: | Line 4: |
<<TableOfContents(2)>> |
|
Line 92: | Line 94: |
| | | | | | | | | | |-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 165: |
==== 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 192: |
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. |
Line 202: | Line 226: |
To just archive a directory with files/directories in it, we would use this command. |
To just archive a directory with files/directories in it, we would use this command: |
Line 215: | Line 238: |
Now to archive and compress a file, we will archive with tar and use gzip's compression so we need to name our file *.tar.gz commonly known as a tarball. {{{tar cfz my_archive_compressed.tar.gz /destination/to/directory |
Now to archive and compress a file, we will archive with tar and use gzip's compression. It's common to use the file ending `.tar.gz` (or less common: `.tgz`) to signify that a file is a gzip-compressed archive. This is how to make such an archive: {{{tar czf my_archive_compressed.tar.gz /destination/to/directory |
Line 220: | Line 243: |
We would do so with this command. {{{tar xfz my_archive_compressed.tar.gz }}} |
We would do so with this command: {{{tar xzf my_archive_compressed.tar.gz }}} Remember to always put the flag `f` before the archive filename, and not in the middle of the other flags like `cfz`. This is because the flag `f` expects an argument which is the filename. If you replace `z` with `j`, you get bzip compression instead of gzip. This is in my experience a better compression for text, but a bit more intense on the CPU. |
Line 225: | Line 253: |
Line 240: | Line 267: |
Line 244: | Line 269: |
getfacl setfacl |
Blinkenshell supports ACLs. You might need them if you want to do something a more odd, like giving one specific user (other than the owner) write permission or something similar. Use the command `getfacl` to view ACLs set on a file: {{{getfacl }}} To set ACLs, use the command `setfacl`: {{{setfacl }}} == Finding files == Using `find`. |
File Management
This is work in progress, not complete. Please help and add more stuff!
Contents
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: