Edit History Actions Discussion

Diff for "Howto/FileManagement"

Differences between revisions 4 and 5
Revision 4 as of 2007-11-06 18:35:31
Size: 10815
Comment: Sizes
Revision 5 as of 2007-11-06 18:51:05
Size: 11597
Comment:
Deletions are marked like this. Additions are marked like this.
Line 224: Line 224:
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 237: Line 236:
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 242: Line 241:
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 247: Line 251:
Line 262: Line 265:

Line 266: Line 267:
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!

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: