Linuix - Some Basic Commands
Linuix - Some Basic Commands
man This command brings up the online Unix manual. Use it on each of the commands below.
man pwd You will see the manual for the pwd command.
pwd Shows what directory (folder) you are in. In Linux, your home directory is /home/particle
cd Changes directories.
cd mydir Moves down from your current directory into the mydir sub‐directory
cd .. Moves up one directory (yes, include the two little dots)
You can also move directly into directories
cd /home/hisdirectory/mydir
cd ~ Takes you back to your home directory (/home/particle)
mkdir dirName Creates a directory with name dirName.
rmdir dirName Removes a directory dirName.
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 datafile1 Show the contents of the datafile1 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 datafile1 Shows you the location of the datafile1 file.
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.
cat files Prints the contents of the specified files.
clear Clears the terminal screen.
finger users Prints descriptions of the specified users.
free Displays the amount of used and free system memory.
reboot Reboots the system (requires root privileges).
shutdown minutes
shutdown ‐r minutes Shuts down the system after the specified number of minutes elapses (requires root privileges).
The ‐r option causes the system to be rebooted once it has shut down.
top Prints a display of system processes that's continually updated until the user presses the q key.
mount Mounts a drive to the operating system. Linux does not 'see' the floppy drive until you tell it to.
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
mount /dev/sda1 /mnt/yourusbfolder –t vfat Mount usb on linux
unmount /dev/sda1 Unmount usb drive
Alsamixer shows you an interface to control sound etc.