The Manual (terminal mode) Next Part 2 >>
man This command brings up the online Unix
manual. Use it on each of the commands below.
For Example:
man pwd You will see the manual for the pwd command.
Accessing files in Folders (Directories) in terminal mode
pwd Shows what directory (folder) you are in.
In Linux, your home directory is /home/particle
· Let's suppose you have several data files (data1, data2 ... etc.) in a directory called muondata.
· Then suppose the directory muondata is an entry in your main home directory, /home/particle .
· If you are in your home directory (where terminals start) and type pwd, you will see /home/particle.
· If you were in the muondata directory, pwd would give you /home/particle/muondata instead
· The last slash after a directory name is optional.
As you can see, each slash (/) indicates another sub-directory.
cd Changes directories.
Examples of relative movement among directories:
cd muondata Moves down from your current directory
into the muondata sub-directory
cd .. Moves up one directory (yes, include the
two little dots)
You can also move directly into directories
cd /home/particle/muondata
Moves from ANY directory into the muondata
sub-directory of your home directory.
cd ~ Takes you back to your home directory
(/home/particle)
Making or Removing a Directory (terminal mode)
mkdir dirName Creates a directory with name dirName.
For Example:
mkdir temp Creates the directory temp.
rmdir dirName Removes a directory dirName.
For Example:
rmdir temp Removes the directory temp.
Looking at or Finding your Files (terminal mode)
ls Lists files.
If you add -al after ls it will give more details for each file. Such as, size, permissions, owners, dates etc.
ls al You'll see a huge list of files that you can't see with the 'ls' command alone and lots of details.
If you see such a long list of files that they scroll off the terminal screen, one way to solve the problem is to use:
ls -al |more Shows one screen of file names at a time.
less data1 Dumps the contents of the data1 file to your screen with a pause at each line so you don't miss any contents as they scroll. You may move through the file using page up, page down, home and end keys. When done with less you use the q key to get back to the main terminal.
whereis data1 Shows you the location of the data1 file.
Altering your Files
rm data1 Deletes the file data1 in the current directory.
rm -i muon* Removes all of your muon data files
(careful!! rm * will remove ALL your files)
The "-i" makes the computer prompt before removing each file. If you really want to work without a net, omit the "-i".
cp data1 newdata/ will copy the file data1 to the directory newdata (assuming it has already been created)
mv data1 newdata/ moves the file data1 to the folder newdata and deletes the old one.
Using the Floppy Disk Drive in Linux
mount Mounts a drive to the operating system.
Linux does not 'see' the floppy drive until
you tell it to.
For Example:
mount /mnt/floppy Allows you to use the floppy drive which has directory name /mnt/floppy
cp aFile /mnt/floppy/ Copies the file aFile to the floppy disk.
ls /mnt/qfloppy/ Allows you to see what files are on your floppy.
You may run into problems moving large files onto a 1.44MB floppy disk. One option to fit larger files is to create a zip archive containing the file onto the floppy. For Example:
zip /mnt/floppy/myFile.zip muon.myDataRun
Moves the file muon.myDataRun into a zip file on the floppy named myFile.zip
After you are done and before you eject it (this is very, very important), you must unmount the floppy.
umount /mnt/qfloppy Allows you to remove the floppy disk
· Make sure you wait for the command prompt to reappear (this might take a few seconds) before ejecting the floppy.
· If you eject the floppy before you unmount the floppy, it may corrupt the data on the floppy and cause the system to be confused if you try to use the floppy again.
· If you make a mistake like this, it's probably best to reboot. Sorry.
df Shows the disk usage. This will tell you how much disk space you have left on your hard drive as well as the floppy.
No comments:
Post a Comment