How To use Linux Filesystems and Files
*How to make a symbolic link
The command ln -s creates a symbolic link to a file. For example, if you use the command
ln -s myfile pointer
you will create a symbolic link named "pointer" that points to the file "myfile". If you use "ls -i", the two files are listed with different inodes.
ls -i myfile pointer
By using "ls -l", the file "pointer" is shown as a symlink pointing to "myfile".
ls -l myfile pointer
+How to mount a DOS filesystem
Type "less /etc/fstab" or "less /etc/mtab". The contents of this file tells all filesystems, their type, etc. The fstab file lists files systems that are mounted when the system started. The mtab file is where the mount command stores the list of filesystems mounted.
df - Disk free space.
du - Disk usage.
To set up the server side, edit the file "/etc/exports" as in one of the examples below then type "exportfs -a". Also activate NFS services using linuxconf.
This is the first attempt which is an example of one way to do it:
/tftpboot/10.1.3.116 linux1(rw,no_root_squash) /tftpboot/filesystems/usr *.mycompany.com(ro,root_squash) /tftpboot linux2(rw,no_root_squash) /tftpboot linux3(rw,no_root_squash) /data linux4(rw,no_root_squash)
This is the way remote booting was set up for nfs:
/tftpboot/lts/ltsroot 10.1.0.101/255.255.0.0(ro,no_root_squash) /tftpboot/lts/ltsroot 10.1.200.1/255.255.0.0(ro,no_root_squash) /tftpboot/lts/ltsroot 10.1.200.2/255.255.0.0(ro,no_root_squash) /tftpboot/lts/linux3 10.1.200.2/255/255.0.0(rw,no_root_squash)
For a remote boot machine, "linux3", after making a /tmp/mnt directory, type "mnt -n 10.1.0.100:/tftpboot/lts/linux3 /tmp/mnt -t nfs". The -n is only needed if the /etc directory is read only.
For a full explanation of the above options and when to use the no_root_squash option, read "The CTDP Linux User's Guide".
To set up the client side on a fully functional Linux machine type "mount -o rsize=1024,wsize=1024 mymachine:/data /mnt/mymachine/data
Making a swap partition
type "mkswap -c /dev/hda3 10336"
The -c has swap check for bad blocks. The 10336 is the size of the partition in blocks, about 10M. The system enables swap partitions at boot time, but if installing a new system you can type "swapon /dev/hda3" to enable it immediately.
Making an ext2 file system on a floppy
Other file systems:
A normal hard drive can have many types of filesystems on it. To create an ext2 file system, type "mke2fs -c /dev/hda2 82080" to create an 82 meg filesystem. Note: mkfs is a front end to many file system types including ext2, minux, and msdos.
fsck - Used to check and repair a filesystem.
fsck is a front end to a filesystem type specific fsck.ext2, fsck.minix, and fsck.msdos.
Syntax: fsck -t type device
Ex: fsck -t ext2 /dev/hda3
The program fsck should never be run on a mounted filesystem with write permission since it can damage the filesystem. Unmount the filesystem before running fsck or be sure it is in read only mode.
To copy type "cp –dpr sourcefile destinationfile"
To remove type "rm –rf directoryname"
dd if=/dev/hdb1 of=/backup/
cp -dpr / /backup
The locate command allows you to find any filename containing a string you type in. This is database driven, so it's fast. To initially load the database, do the following command, which will take a couple minutes or so to run:
Thereafter, type "locate filename" where "filename" is the name of the file you want to find.
The whereis command is very useful for finding binary programs and their associated man pages.
The shell assigns the number 1 to standard output, and 2 to standard error output.
|gcc test.c >& errors||Redirects stdout and stderr to the file errors.|
|gcc test.c &> errors||Same as above|
|gcc test.c 2> errors||Redirects error messages to the file errors|
|gcc test.c 2>errors >/dev/null||Redirects errors to the file errors and throws away the standard output messages.|
See the bash(1) man page for more information on redirection of standard output and standard error.
How to make a single boot floppy:
dd if=/vmlinuz of=/dev/fd0
rdev /dev/fd0 /dev/hda2
Your root filesystem may be somewhere other than "/dev/hda2".
/mnt /etc/auto.misc --timeout 20
The above example sets the program to unmount the device after 20 seconds.
cd -fstype=iso9660,ro :/dev/cdrom fl -fstype=auto :/dev/fd0
This will cause the cd-rom to be mounted when you access the directory "/mnt/cd" and the floppy to be mounted when you access "/mnt/fl". The directories "/mnt/cd" and "mnt/fl" must not exist in order for this to work.