Contents
Why Use CAEDM Linux
There are many reasons to use Linux, some philosophical, financial, and technical. As a CAEDM user in engineering, Linux is incredibly useful when dealing with large models, fine meshes, huge datasets, or massive files that use gobs of memory. CAEDM has Linux machines with dozens of gigs of memory and processors (ssh.et.byu.edu). Also, some software is only available on the Linux machines.
Desktop Environments
The Linux workstations in the labs use the GNOME desktop environment by default. The K Desktop Environment (KDE) is also available. You can select between the to environments from the login screen (Menu->Session Type). GNOME and KDE are designed to be as user-friendly as possible, so it shouldn't take long to pick ether of them up. In the GNOME there are two panels, one at the top, one at the bottom. The bottom panel displays all windows open in your workspace, as well as the trash icon in the lower right-hand corner. The upper panel shows system information to the right, and menus and applications to the left. These menus are used to navigate and use the system. Their purposes are more or less self explanatory. The Applications menu allows you to navigate the applications available on the machine. The Places menu is for navigating the file system, and the System menu is for system administration. You shouldn't have to use the latter menu in the context of the CAEDM labs. In KDE, there is just a single panel at the bottom. The guy wearing the red fedora is like your start menu in Windows, with a Applications tab where your programs will be. These are also pretty self explanitory, Caedm Local Apps will have your CAEDM specific applications, Development will have some programming tools, Office will have your office suit, an so on.
The File System
GNOME uses a program called Nautilus and KDE uses a program called Dolphin to navigate the file system. The file systems on the Linux workstations are set up much like those on the windows workstations--there is a local system (whose contents are deleted upon logging out) and a map to the J drive, where you can access your CAEDM files.
The Shell
The other way to navigate a Linux system is using bash/tcsh, two kinds of shells available in CAEDM. To log into a shell on a workstation, go to Applications >> System Tools >> Terminal. Or, simply access one of the virtual terminals by pressing ctrl+alt+f[2-6] (use ctrl+alt+f1 to get back to the GUI). To log into a shell from home or on campus, use SSH from the terminal on your Linux/Macintosh machine or through Putty on your windows system. How to use the shell is not explained extensively on the Help Pages, but there is plenty of documentation online.
How to access a USB drive
First Plug the USB drive into the computer. Then there are several ways to access a USB jump drive.
- The easiest way is to Double Click the "My Devices" icon on the desktop.
- This will show you all of the devices connected to the computer. (similar to "My Computer" in Windows)
- One of these devices should be your USB jump drive. (It may say something like "Hard Disk (sdb1) [/media/<The Name of your Drive>]")
- Double Click on this icon and you should see the files on your drive.
- To acces the device from the command line or in a program type the pat of the drive.
- From a command line type: cd /media/<The name of your drive>
- From a program type: /media/<The name of your drive>
Linux account options
Most Linux account configuration is done in various configuration files on the J Drive. They will start with a period, for example: .config.
Useful linux commands
To the beginner, Linux can be a very intimidating operating system. Though some of the commands and interfaces resemble their familiar counterparts in a Windows based system, Linux is still another language. These commands should be very helpful and cover most of the basic operations.
General Hints
- Linux is case sensitive.Using lower case filenames will eliminate a lot of confusion later. Also avoid using spaces in filenames, as they are problematic in Linux. Use an underscore ( _ ) instead.
- Ctrl-C will stop a command that is currently running. If the machine starts to hang while running a command, this will usually stop it and allow you to continue with a different command.
- Online help for a given command can always be accessed by typing man command.
Directory Commands
- ls
- Lists all the files in a directory, using the switch -al will list all of the permissions on a file and the last date modified.
- cd
- Change directory. For example: cd www will take you to the www directory.
- cd ..
- will take you one directory down.
- cd $home (cd ~/)
- will take you to your home directory no matter where you are.
- mkdir
- Create a directory, for example: mkdir directory_name
- rmdir
- Removes an empty directory, for example: rmdir directory_name
- pwd
- Print the working directory name to the screen (i.e., tell you where you are).
File Commands
- chmod
- Changes the permissions of a file. Users are designated by u for user, g for group or a for all users. Read is designated by r, write by w, and execute by x. a + or - designate whether the permission is being added or removed. For example: chmod a + x filename will change the permissions on filename to be executable by all users.
- cp
- Copy files. For example: cp source_file target_file
- mv
- Move files. For example: mv source target_location
- rm
- Remove or delete files. For example: rm file_to_remove. Using the switch -r deletes all recursive files and directories, or all the subdirectories. Use this switch very carefully, as it will delete everything in those directories!
Network Commands
- nslookup
- Nslookup gives the ip address of a domain. For example: nslookup domain_name
- ping
- Ping sends out a packet to a server and gets a response. This can be used to measure response times of a server or website. Using the ;switch -s
- returns a ping time.
- ssh
- Allows you to log onto another computer from a remote station. This can be used to access information stored locally on another machine.
Job Control
- ps
- This finds your processes.
- kill
- This kills or ends a process. Identify the process with its Process ID Number. For example: kill 1234
- Ctrl-Z
- This suspends a process. To end or break a process, use Ctrl-C.
- fg
- Resumes a suspended process and returns the process to the foreground.
- bg
- Resumes a suspended process and runs it in the background.
- top
- Lists all commands being run on that machine.
Print Control
- cancel
- cancels a print job. A user can only cancel their own print jobs before it starts to print. For example: cancel cb423psc-1245
- lpstat
- list print jobs waiting in the queue. For example: lpstat cb423ps
Misc Commmands
- man command
- Brings up manual for command
Linux File Permissions
If you type 'ls -l' at a command prompt, you might see something like
% ls -l (clipped) -rwxrw---- 1 johnson cheme 1056 Oct 3 10:37 index.html -rw------- 1 johnson cheme 691 Sep 29 15:54 myface.jpg (clipped)
The -rwxrw---- represents the permissions for index.html. The first character represents special attributes. 'd' is for directory '-' is for normal file. The remaining 9 characters are intrepreted in groups of 3. The first 'rwx' is user permissions. In this case, index.html is readable writable, and executable by the user. The second group of 3 characters ('rw-') is the group permissions. In our example, index.html is readable and writable (but not executable) by anyone in the group 'cheme'. The final 3 characters ('---') are permissions for 'world' or 'everyone'. In this case, index.html is not readable by anyone outside the group cheme.
How to set Linux Permissions
Symbolic Mode
You can set file permissions with the chmod
command. Both the root user and the file's owner can set file permissions. chmod
has two modes, symbolic and numeric.
The symbolic mode is pretty easy to remember. First, you decide if you set permissions for the user (u), the group (g), others (o), or all of the three (a). Then, you either add a permission (+), remove it (-), or wipe out the previous permissions and add a new one (=). Next, you decide if you set the read permission (r), write permission (w), or execute permission (x). Last, you'll tell chmod
which file's permissions you want to change.
Let's have a couple of examples. Suppose we have a regular file called testfile
, and the file has full access permissions for all the groups (long directory listing would show -rwxrwxrwx
as the file's permissions).
Wipe out all the permissions but add read permission for everybody:$ chmod a=r testfile
After the command, the file's permissions would be -r--r--r--
Add execute permissions for group:$ chmod g+x testfile
Now, the file's permissions would be -r--r-xr--
Add both write and execute permissions for the file's owner. Note how you can set more than one permission at the same time:$ chmod u+wx testfile
After this, the file permissions will be -rwxr-xr--
Remove the execute permission from both the file's owner and group. Note, again, how you can set them both at once:$ chmod ug-x testfile
Now, the permissions are -rw-r--r--
As a summary, have a look at this quick reference for setting file permissions in symbolic mode:
Which user? | |
u | user/owner |
g | group |
o | other |
a | all |
What to do? | |
+ | add this permission |
- | remove this permission |
= | set exactly this permission |
Which permissions? | |
r | read |
w | write |
x |
execute |
Numeric Mode
The other mode in which chmod
can be used is the numeric mode. In the numeric mode, the file permissions aren't represented by characters. Instead, they are represented by a three-digit octal number.
4 = read (r)
2 = write (w)
1 = execute (x)
0 = no permission (-)
To get the permission bits you want, you add up the numbers accordingly. For example, the rwx permissions would be 4+2+1=7, rx would be 4+1=5, and rw would be 4+2=6. Because you set separate permissions for the owner, group, and others, you'll need a three-digit number representing the permissions of all these groups.
Let's have an example.
$ chmod 755 testfile
This would change the testfile
's permissions to -rwxr-xr-x
. The owner would have full read, write, and execute permissions (7=4+2+1), the group would have read and execute permissions (5=4+1), and the world would have the read and execute permissions as well.
Let's have another example:
$ chmod 640 testfile
In this case, testfile
's permissions would be -rw-r-----
. The owner would have read and write permissions (6=4+2), the group would have read permissions only (4), and the others wouldn't have any access permissions (0).
The numeric mode may not be as straightforward as the symbolic mode, but with the numeric mode, you can more quickly and efficiently set the file permissions. This quick reference for setting file permissions in numeric mode might help:
Which number? | |
0 | --- |
1 | --x |
2 | -w- |
3 | -wx |
4 | r-- |
5 | r-x |
6 | rw- |
7 | rwx |