Friday, December 17, 2010

File Systems 3

Now I realize I should have made my blog posts with the chapter name and a number signifying which one it is. Oh well.

Now on cp command. Basic syntax for copying something would be cp this_file /over/here. Now switches

-f does not ask when overwriting files
-i interactively asks before overwriting
-r recursive
-s creates symlink to the source file
-u only copies when the source is newer or there is no pre-existing target.

mv on the other hand moves files. It uses the same syntax as cp and switches (except recursive because it is recursive).

Here's something that I would just use a GUI but anyways. The dd command (according to the book) is often use for duplicating things like a CD .img or partition. So an example would be.

dd if=/dev/fd0 of=/dev/fd1. if is inputed, of is output and this would do a 1:1 copy of a CD to another CD. The same thing can be used for a partition, just change the devices. If you want to backup the MBR you would do.

dd if =/dev/hda of=/root/MBR.img count=1 bs=512. count sets the number of reads from the input file and bs sets the block size so you don't copy all the blocks.

Lastly mkdir/rmdir and rm. mkdir makes directories. To make a directory you would do mkdir directory or mkdir directory/directory2 to make a subdirectory. rmdir works the same way but the directory must be empty.

rm removes files AND can remove directories full of files. You don't need me to tell you the syntax so here are the switches.

-f removes a file without a prompt
-rf removes all contents in a directory with a prompt.

Enough for now...

Wednesday, December 15, 2010

File Systems 2

In the root of the filesystem (/) you have the common directories (15 of them). Here are a few.

etc-Configuration files
dev-Device files
home-Home directories for users
lost+found-Henry explained this one. It's where files go when fsck finds corrupted files.
opt-Third-party applications
root-Root user home directory

Here is the redundant stuff I was talking about earlier.

As you know cd is used to navigate the file system. That's it on cd. ls is more interesting.

ls lists files and directories.
ls -l gives you the permissions, links, date, group, and owner.
ls-a lists all files (means it lists hidden files too)
ls -i lists inode info
ls -lh shows "human-readable" output so that means things are in KB, MB etc...

Command here that I didn't know about is file.
file basically tells you what kind of file the file you're looking at is. So...
A text file might read out as text_file: ASCII text or if it's a binary it will tell you what kind of architecture it is.

Finally there's touch. touch can be used for different purposes the basic being creating a blank file like "touch blankfile". touch is also used to update the file's times. So if you wanted to change the file date of blankfile you would do touch -t yyyymmddhhmm blankfile, I believe that is self explanatory. One cool thing you can do is touch -r blankfile blankfile 2 where blankfile's time is copied to blankfile 2. Yup.

Monday, December 13, 2010

This Week - Dec 13

I will continue reading into the File Systems chapter most likely finishing this week. After that there are 3 more chapters so I should be able to get things done with time to spare.

Referring back to Mr. Elkner's previous question about how useful the LPIC. I haven't finish it yet so I can't really comment on it but I would say that it would be best to have students who are interested in being a sysadmin, have them work the first year doing sysadmin things... but also make sure they get to try the basic stuff that is in the book so when second year comes around they won't have to use as much time reading some chapter they already know. Of course they're going to have to learn about the old crap too but that can be reserved for second year also.