You are on page 1of 9

Basic Linux Commands

Modes of Operation

The linux operating system used for the PARTICLE DAQ system can be used either in a terminal mode where you type commands or in a Windows Explorer style graphical user interface (GUI).

The Explorer-like GUI can be used for file manipulation functions (e.g., copying a file to a floppy) or deleting or moving files on the disk. It cannot be used to run the PARTICLE DAQ itself.

To begin using the Explorer-like GUI, double click on the icons on the Desktop. For the most part, Explorer mode will be familiar from Windows or MAC OS, so with a few exceptions, this information will not focus on this. Where something is much more easily done from Explorer mode, it will be highlighted here.

To begin working in the terminal mode, you will need to open a terminal. This can be accomplished by clicking on the terminal icon in the bottom icon bar, by using the main menu (footprint icon in lower left of bottom icon bar) System Tools -> New Terminal.

The Manual (terminal mode)

 Then suppose the directory muondata is an entry in your main home directory. pwd would give you /home/particle/muondata instead . data2 . your home directory is /home/particle  Let's suppose you have several data files (data1..  If you are in your home directory (where terminals start) and type pwd. In Linux. /home/particle . Use it on each of the commands below.man This command brings up the online Unix manual.) in a directory called muondata. For Example: man pwd You will see the manual for the pwd command.  If you were in the muondata directory. Accessing files in Folders (Directories) in terminal mode pwd Shows what directory (folder) you are in. etc.. you will see /home/particle.

Moves up one directory (yes. cd ~ Takes you back to your home directory . each slash (/) indicates another sub-directory. 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. The last slash after a directory name is optional.. Examples of relative movement among directories: cd muondata Moves down from your current directory into the muondata sub-directory cd . cd Changes directories. As you can see.

rmdir dirName Removes a directory dirName. Looking at or Finding your Files (terminal mode) ls Lists files. For Example: rmdir temp Removes the directory temp. . For Example: mkdir temp Creates the directory temp.(/home/particle) Making or Removing a Directory (terminal mode) mkdir dirName Creates a directory with name dirName.

size. Such as. permissions. dates etc. 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. owners. You may move through the file using page up. whereis data1 Shows you the location of the data1 file. . If you see such a long list of files that they scroll off the terminal screen. ls al You'll see a huge list of files that you can't see with the 'ls' command alone and lots of details. home and end keys. When done with less you use the q key to get back to the main terminal. one way to solve the problem is to use: ls -al |more Shows one screen of file names at a time. page down.If you add -al after ls it will give more details for each file.

which means that the operating system will scan the disk so that it . omit the "-i". However. If you really want to work without a net. Using the Floppy Disk Drive in Linux The simplest way to access the floppy drive under Linux is to use the Explorer-like interface. 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. will copy the file data1 to the directory newdata (assuming it has already been created) cp data1 newdata/ mv data1 newdata/ moves the file data1 to the folder newdata and deletes the old one. there is a very important detail! To access the files on the disk.Altering your Files rm data1 Deletes the file data1 in the current directory. you have to mount the floppy disk.

This is why. to mount the floppy. . you just double click on the desktop icon. this may result in unexpected actions unless you unmount the disk. Things are more complicated by possible in the terminal mode: mount Mounts a drive to the operating system. you must first right-click on the desktop icon. For example. When this is complete (and it may take a long time since it may have to complete writing files to the floppy!). This will bring up a window with the contents of the floppy. and select Unmount volume or Eject (either does the same thing). (Note: unlike in Windows and MacOS. when you drag a file from your home area to the floppy. or take any other actions you would with normal files. it moves the file instead of making a copy. you may push the eject button on the floppy to remove it. its just that those operating systems hide that detail from you a little better.) In the Explorer interface. Linux does not 'see' the floppy drive until you tell it to. your files may be only partly there or not there at all! (This is no different then under Windows or DOS.) To remove the disk. and you may drag and drop files there. Although your computer will be perfectly happy to allow you to remove the disk by pushing the eject key on the laptop floppy drive.can recognize the files on it. for example. you must eject floppy disks from the disk properties menu in Windows.

very important). ls /mnt/qfloppy/ Allows you to see what files are on your floppy.44MB floppy disk. umount /mnt/qfloppy Allows you to remove the floppy disk .zip After you are done and before you eject it (this is very. One option to fit larger files is to create a zip archive containing the file onto the floppy. You may run into problems moving large files onto a 1.myDataRun into a zip file on the floppy named myFile.myDataRun Moves the file muon.For Example: Allows you to use the floppy drive which has directory name /mnt/floppy mount /mnt/floppy cp aFile /mnt/floppy/ Copies the file aFile to the floppy disk. For Example: zip /mnt/floppy/myFile.zip muon. you must unmount the floppy.

 If you make a mistake like this. Make sure you wait for the command prompt to reappear (this might take a few seconds) before ejecting the floppy. . it's probably best to reboot. This will tell you how much disk space you have left on your hard drive as well as the floppy. Sorry.  If you eject the floppy before you unmount the floppy. df Shows the disk usage. it may corrupt the data on the floppy and cause the system to be confused if you try to use the floppy again.