Sie sind auf Seite 1von 4

Basic Linux Commands for the Stat Computers v1.

0
cd < Used to move between directories >
cd ~ Go to your home directory
cd .. Go up one level
cd subDir Go down one level into subdirectory subDir
pwd Returns the "present working directory" --- where you are now
ls < Used to view files in a directory >
ls View all visible files in the pwd, just names
ls -l View all visible files & info such as file size, time last
modified and current file permissions
ls -a View all files in the pwd, even the hidden ones (begin with .)
ls -al Combination of previous two options
mkdir x Make a subdirectory in the pwd with name x
rmdir x Delete a subdirectory in the pwd with name x ; x must be empty
rm f Delete file f from the pwd
cp f nloc Make a copy of file f at new location nloc
Example: cp code.r ~/private/backups/ # Copy has same name
Example: cp code.r ~/private/backups/renamedCode.r # Copy has new name
mv f nloc Move a file to a new location
Example: mv code.r ~/private/backups/ # File is moved
Example: mv code.r code2.r # Renamed file does not move
chmod XYZ f
Changes the permissions for file f based on the three digits XYZ
The digits each represent one of 0 - 7 in binary
X, Y & Z represent the permissions for you, your group & everyone, resp.
I think everyone with a Stat account qualifies as in "your group"
Consider the listing given by ls -l .emacs
-rw-r----- 1 dawson dawson 3602 Dec 7 2006 .emacs
The 1st "-" indicates this is a file, not a directory; if it were,
this would be a "d"
The remaining nine spaces are three sets of three spaces and correspond
to the values XYZ; in this example:
X = rw- = 110 = 6,
Y = r-- = 100 = 4,
Z = --- = 000 = 0
The three spaces in each digit represent read, write and execute permissions
Read permission allows you to look at a file
Write permission allows you to make changes to a file
Execute permission allows you to run a file
In the above example, I have read and write permission, my group has read
permission, and everyone else can't do squat with my .emacs file
If I wanted everyone else to be able to read it, I'd use
chmod 644 .emacs
to get
-rw-r--r-- 1 dawson dawson 3602 Dec 7 2006 .emacs
Generally speaking, only you and the Administration can change the
permissions on your files
File permissions may be overruled by the permissions on the folder
they are in; folder permissions may also be changed using chmod
Rule of Thumb: The less access other people have, the better
dict word
Brings up several definitions for the word specified;
If the word is misspelled but close, suggestions will be offered
man command
Brings up the Linux manual's help page for the specified command;
I have generally found this to be unhelpful
firefox
Connects to the internet using Firefox;
Due to an issue that came up some time ago, I have been using
firefox -cleanup
But this fix may no longer be necessary
emacs f
Opens up file f for editing in text editor Emacs
mgv f.ps
Opens up postscript (.ps or .eps) file f for viewing in Ghost View
acroread f.pdf
Opens up pdf file f for viewing in Acrobat Reader
xv f.jpg
Opens up jpeg file (.jpg or .jpeg) f for viewing & editing in VX editor
/s/nvu/bin/nvu
Opens up NVU, an HTML editor. Files can be opened using NVU's menus.
mswordview f.doc
Opens a Word file in a Word Emulator for viewing; no edits allowed
> Word itself is available in the GNOME Desktop environment
msexcelview f.xls
Opens an Excel file in an Excel Emulator for viewing; no edits
> Excel itself is available in the GNOME Desktop environment
msppview f.ppt
Opens a Powerpoint file in a Powerpoint Emulator for viewing; no edits
> Powerpoint itself is available in the GNOME Desktop environment
##################################
Quick Tips:
- Adding an & at the end of a command will execute the command while
freeing up the command line for another command (HIGHLY RECOMMENDED)
- You can print a .ps file by opening it in mgv & selecting File -> Print...
When prompted, finish the command
/s/std/bin/lpr
with
/s/std/bin/lpr -Ppr1274
in order to print to the printer in 1274. -Ppr1207, etc also available
- Aliasing
If you use a command often, you might want to alias it to a short command
There are already some default aliases active on your account;
You can make your own by modifying you .cshrc.local file
1) Give yourself permission to modify .cshrc.local (if needed)
2) Open .cshrc.local for editing in emacs
3) Find the existing lines of code for aliases
4) Add your own aliases
5) Save the changes
6) You may need to log out & back in for the changes to take effect
For example, I've added these aliases:
alias i 'firefox -cleanup &' # To fix problem in program
alias p 'cd ~/private/S775' # Link to 775 directory
alias u 'cd ~/public/html/tutorials/' # Link to tutorial directory
alias nvu '/s/nvu/bin/nvu' # Start NVU GUI interface
Thus I can go to commonly visits directories or the web with
one fluid motion of two same-hand keystrokes
- dict is very helpful when working in LaTeX, as it has no spell checker
- The GNOME environment can be chosen using the bottom tab menus before
you log in. You can set it as a default if you like; those who are
used to Windows PCs or Macs will find this more familiar, but
I've always found GNOME to be a pain when directing R code since the
directory structures aren't immediately visible as in Linux.
However, GNOME is pretty much the only way to edit Microsoft Apps without
logging into one of the Stat Windows machines.
>>> This concludes Basic Linux Commands for the Stat Computers v1.0
(c) John Dawson 9/26/2007

Das könnte Ihnen auch gefallen