• Skip to Main Content
  • Go to the Website's Home
  • Go to Website News
  • Go to About this site
  • Skip to Audience Navigation Menu
  • About
    • Welcome to the College
    • Facts and Figures
    • Message from the Dean
    • Visit Us
    • College Administration
    • News Center
    • More...
  • Research
    • Research
    • Departments
    • Faculty Directory
  • Admissions
    • Undergraduate Admissions
    • Graduate Admissions
    • Undergraduate Recruiting
    • Graduate Recruiting
    • More...
  • Academics
    • Course Guide/Bulletin
    • Departments
    • Teaching
    • Programs and Degrees
    • Support Services
    • More...
  • Departments
    • Aerospace Engineering
    • Atmospheric, Oceanic and Space Sciences
    • Biomedical Engineering
    • Chemical Engineering
    • Civil and Environmental Engineering
    • Electrical Engineering and Computer Science
    • Industrial and Operations Engineering
    • Materials Science and Engineering
    • Mechanical Engineering
    • Naval Architecture and Marine Engineering
    • Nuclear Engineering and Radiological Sciences
  • Support the College
    • Giving
    • Involve Yourself
    • Corporate Relationships
    • More...
  • Information for:  
  • Alumni
    • Alumni Website
    • Alumni Society
    • Get Involved
  • Students
    • Academic Calendar
    • Course Guide/Bulletin
    • Financial Aid
    • Career Resources
    • Advising Center
    • More...
  • Faculty
    • College Faculty Meetings
    • Getting Research Funding
    • Employment Opportunities
    • More...
  • Staff
    • Department Listing
    • College Administration
    • Contacts
    • Faculty Directory
    • Staff Handbook
    • Employment Opportunities
    • More...
  • Friends
    • K-12 Outreach
    • Parents Weekend
    • Community Service Projects
    • Contacts
  • Corporations
    • Corporate Relations
    • Sponsoring Research
    • Opportunties for Interaction
    • Professional Education
    • Technology Transfer and Licensing
    • More...

CAEN

CAEN

  • About CAEN
    • Introduction
    • A Student Guide to CAEN
    • Policies
    • Organizational Chart
    • Employment
    • Hours of Operation
  • Computer Labs
    • Overview
    • Guidelines
    • Comparison Chart
    • Lab Descriptions
    • Lab Map
    • Realtime Lab Monitor (external link)
    • Reserving a Lab
    • Document Scanners
    • Virtual CAEN Labs
  • Computing Accounts
    • Overview
    • Obtaining an Account
    • Account Eligibility & Fees
    • Expiration of CAEN Accounts
    • Backups & Restorations
    • Passwords at U-M
  • Connecting to CAEN
    • Overview
    • Linux Login Servers
    • Secure File Transfer Protocol (SFTP)
    • Secure Shell (SSH)
    • Virtual CAEN Labs
    • Virtual Network Computing (VNC)
    • Virtual Private Network (VPN)
    • X11 Connections
  • Departmental Services
    • Overview
    • CAEN Operating Environment (COE)
    • Course Support
    • Data Storage
    • Instructional Technology
    • Network Support
    • Software Licensing
    • Ordering & Purchasing
  • Email
    • Overview
    • U-M Exchange Accounts
    • Group Email Distribution
    • CoE Email Lists
    • Recent Service Changes
    • Frequently Asked Questions
  • Help & Support
    • Overview
    • The CAEN Hotline (external link)
    • The CAEN Service Center (external link)
    • Search Documentation (external link)
    • Frequently Asked Questions (external link)
    • Administrative Forms (external link)
  • Information Security
    • Information Security at the College
    • IT Security Recommendations
    • Recent Announcements (external link)
  • Network & Wireless
    • Overview
    • Departmental Services
    • Ethernet Connections
    • Name Service (DNS) Requests
    • Network Status (external link)
    • Wireless Networking
  • Printing
    • Overview
    • Page Allocations & Costs
    • Printer Names & Locations
    • Using the Xerox Printers
    • Web Printing
    • Frequently Asked Questions (external link)
  • Software & Licensing
    • Overview
    • Software Listing
    • Course Software Requests
    • Departmental Licensing
    • Online Documentation
    • User-Contributed Software
    • Linux Utility Programs
  • Web Services
    • Overview
    • Content Management System
    • Forms Application
    • Google Search Appliance
    • Group Web Space
    • Tips on Web Photos
    • Statistics (external link)
Contact CAEN Support
(external link warning) Link goes to external page

Home  /  CAEN  /  Frequently Asked Questions  /  Linux  /  Navigating Linux

  • Navigating Linux
  • Linux Workstations
  • Text Editors
  • LaTeX
  • Scripting & Programming

Navigating Linux

  • How can I get started using Linux?
  • What basic commands should I know in order to begin using Linux?
  • What are dotfiles? How can I customize my dotfiles?
  • What Linux shells are supported at CAEN?
  • How can I run an alternate shell in the CAEN environment, such as tcsh or bash?
  • There is a large file named "core" in my home directory. Can I delete it?
  • My backspace key does not function correctly. How do I fix this?
  • How do I deal with file or directory names with spaces in them?
  • How can I find a file if I can't remember which directory it is in?
  • How can I set up a symbolic link to a directory? How do I remove it?
  • How can I set the Linux prompt to show what directory I am in?
  • How do I uncompress a file with the .gz extension?
  • How do I extract the contents of a file with the .tar.Z or .tar.gz extension?

How can I get started using Linux?

This tutorial is designed to introduce you to the Linux operating system used on CAEN desktop workstations. By reading through this tutorial and following the step-by-step instructions on a CAEN workstation or terminal, you will learn how to log in and issue simple commands. You also can follow this tutorial via a remote login session.

Note: In very few of the commands do we cover all of the options, flags and variations of the command. If you are interested in more detail about any command, it is advisable to consult the man pages (type man command).

Logging in at the Console

You can log into any CAEN Linux lab workstation with your U-M uniqname and password. Moving the mouse or tapping the keyboard will activate a blank screen. You will see a login dialog box with the message Welcome to CAEN. If this message is obscured, you may first need to press Ctrl-C to refresh the screen. Log in using the following steps:

  1. Type your uniqname at the Login: prompt and press the Return key.
  2. Enter your password at the Password: prompt, and press Return again. Do not be alarmed if you get a message informing you that there has been an error authenticating to the umich.edu AFS cell. This will occur if you do not have an ITCS account or if your ITCS and CAEN passwords are different.
  3. A dialog box with a message of the day will appear.
  4. After the system starts up, an xterm window will appear in the upper left screen area. The program xterm is a terminal emulator, which provides a shell.

AFS and Kerberos

AFS is the distributed file system that allows CAEN's Linux machines to share files on servers throughout the network. Your home directory is stored on an AFS file server. You can access it from any CAEN workstation.

AFS also extends connectivity beyond the world of CAEN. AFS can be thought of as a shared file system for the entire world. Currently, this hierarchical file system is set up with the /afs directory as the root directory. Below that level are directories for each cell, or independent organization. The cell /afs/umich.edu is the cell administered by the Information Technology Central Services (ITCS) and houses all AFS home directories and ITCS software for the U-M community. You ITCS AFS home directory is located at /afs/umich.edu/user/l1/l2/uniqname, where l1 and l2 are the first and second letters of your uniqname respectively.

AFS utilizes the Kerberos authentication scheme to validate users' rights to log in and access files. Kerberos is an extension to the normal Linux authentication mechanism and significantly improves network security. Files are only exchanged between a client and a server if both machines are able to recognize a valid electronic authentication token (also known as a ticket).

When you log in to a lab workstation you are automatically placed in a process authentication group (PAG). Your default token lifetime is 25 hours. If you anticipate that you will be running a job that exceeds this time limit, you can use Contact CAEN on the CAEN website and have your token lifetime extended up to 30 days.

gettokens

The gettokens command allows to you obtain or extend an AFS token (privileges) for files in a particular AFS cell. To obtain U-M AFS privileges, type gettokens. You may also use gettokens to obtain privileges in other AFS cells (at MIT, CMU, etc.) by typing gettokens @cellname, where cellname is the name of the AFS cell, if you have a computer account in that cell.

Process Authentication Groups (PAGs)

There is an additional twist in the authentication story that can cause considerable confusion if not properly understood. This twist is caused by a concept called Process Authentication Groups (PAGs).

A PAG is a group of processes (running programs) defined by a starting process (such as a login shell or a sub-shell) and all of the processes that were started by that starting process. For example, when you log in remotely, you are given a single shell (which displays the % prompt for you and accepts commands). This shell, and all of the programs that you execute or start within that shell, are part of the same PAG, unless you explicitly create a new PAG.

There is one special PAG, which we will call the system PAG, which is the group of all processes that aren't part of another PAG. This will become important in a moment.

The AFS-PAG Connection

All AFS privileges are associated with a PAG. This PAG may be a login shell, an Xdm startup process, or the system PAG. If you authenticate within a PAG, the privileges you receive are only usable by other processes in that PAG. So, for example, if you log in and get a PAG and are authenticated in that PAG, your privileges will only work while you remain in that PAG. If you log in again and receive a different PAG, you will need to authenticate separately.

Do you have a PAG?

The command groups can be used to tell whether you have a PAG or not and to identify PAGs. Normally, the groups command will give you a list of groups that you are a member of.

% groups

users

When you have a PAG, this group list will be preceded by two large numbers.

% groups

33536 32593 users

At least one of these two numbers will be different for different PAGs. Thus, if you see different numbers given by separate groups commands, it means that the commands were executed in separate PAGs. If the numbers are the same, then the commands were executed in the same PAG. If you don't see the numbers at all (as in the first example above), then you are using the system PAG.

The Shell

The shell is the system's command interpreter. It is a program that reads in the lines you type and performs the specified operations. While there are several types of shells available, the csh (or C shell) is the default shell for CAEN workstations. After a shell is opened, the prompt (the name of the machine you are on, followed by %) is displayed. You can run programs or enter commands at this prompt.

Commands usually have a variety of options. Options follow the command name and are usually made up of an initial minus sign - and a single letter meant to suggest the meaning. For example, ls -t causes the files in a directory to be displayed in time order. Commands may also allow for optional arguments. For example, the calendar command, cal, can be entered with two arguments specifying values for the desired month and year, i.e. cal 5 2006. Remember also that all Linux commands and filenames are case sensitive.

Manipulating Shell Windows and Icons

Shell windows are the interface with the operating system. These windows can be moved or resized using the first mouse button. Scroll bars on the right hand margin of the window enable you to see previous contents. Two small control buttons are located in the upper right corner of the window. Pressing the right button enlarges the window to cover the entire screen. Pressing the left control button iconifies the window. You can reactivate the window by double-clicking the icon with the first mouse button.

Using Multiple Shells

Linux provides multi-tasking environments that allow you to use multiple shells in order to execute several commands simultaneously. For example, you can copy and paste text from one shell to another, while a third shell is executing a command. Text in shell windows is selected using the left mouse button and pasted using the middle mouse button. You can select and copy any body of text that appears in a shell window into any shell window you choose. The following steps will show you how to use multiple shell windows:

  1. Move the cursor into the gray area of the screen, the root window, and press the second mouse button, drag to New Shell and release the mouse. A new window appears on your screen.
  2. Place the cursor in the top bar of the first window (it should by partially blocked by the windows you just created) and press the first mouse button. This moves the activated window in front of any windows that may be obstructing your view.
  3. Type date at the prompt of the window you just activated. The machine should print today's date and the current time.
  4. Select the word date by placing the cursor at the beginning of the word, pressing the first mouse button, and dragging the cursor across the entire word. Release the button once the word is highlighted in black. If you make a mistake, just click the first mouse button once to deselect the text.
  5. Activate the other window using the same procedure in step 2.
  6. Place the cursor at the prompt and press the second mouse button. The command, date, should have been copied into the new window.
  7. To close a shell window, type exit at the shell prompt inside of it.

Editing Files

There are several editors that can be used. The most common are vi, nano, emacs, nedit and the CDE Text Editor, dtpad. The visual editor, vi, is the standard screen editor supplied with the operating system. If you are interested in vi, refer to our vi tutorial. The emacs program has more programming capabilities and is more difficult to learn initially (see our emacs tutorial). The nano editor can be used on a remote VT100 terminal session. It is easier to learn than either the vi or the emacs editor. NEdit is a powerful text editor with a word-processor-like X interface. For more information on NEdit, use the xman program or type man nedit.

Printing

If you would like to print the file you just created, first find out the name of the printer. If you are in a lab, you can read the printer's name from the top of the printer itself. To print your file in a CAEN lab or in the Duderstadt Center, use one of the following commands:

lpr -Pprintername .plan

To see the status of your print job or check the printer queue in a CAEN lab, use:

lpq -Pprintername

To remove a job from a print queue, use the jobnumber obtained from the lpstat or lpq command:

lprm jobnumber

Pipes and Redirection

Linux allows you to redirect the input/output of commands to files or to other commands. The < redirects the contents of a file as input to a command. The pipe, |, redirects the output of one command as the input of another command. The > symbol redirects the output of a command to a file, and the >> redirects the output of the command to the end of a file (appends to the given file). Take the time now to try out some of the following commands:

mkdir Temp; cd Temp - Create a Temp directory for this session.

date > today.txt - Send the output of the date command to the file today.txt.

ls > also.txt - Send the output of ls to the file also.txt.

cat today.txt also.txt - Display the files today.txt and also.txt.

cat today.txt also.txt today.txt > zzz - Send the output of the cat command to the file zzz.

cat zzz - Display the file zzz.

date > logfile - Send the output of date to the file logfile.

date >> logfile - Append the output of date to the file logfile.

date >> logfile - Append another date entry to the end of the file logfile.

cat logfile - Display logfile.

echo 'The last date' - Display the string 'The last date'.

echo 'The last date' >> logfile - Append the string 'The last date' to logfile.

cat logfile - Display logfile.

mail uniqname < logfile - Use the mail command to mail yourself the logfile. Here the input for the mail command comes from a file instead of the terminal screen.

cat /etc/motd > tao.txt - Display the file tao.txt.

cat tao.txt | wc - Send the output of cat tao.txt to the input of the command wc.

cat tao.txt | grep master - Send the output of cat tao.txt to the input grep master. This will, in turn,output all of the lines that contain the word master to the screen.

cat tao.txt | tail - Pipe the output through the command tail. This will display the last 10 lines.

cat tao.txt | head - Pipe the output through the command head. This will display the first 10 lines.

cat tao.txt | more - Pipe through the page handling command more. This will pause between pages on the screen.

cat tao.txt | grep 'and' | sort - Pipe the output of cat tao.txt through grep to search for the lines with the string and. Then pipe the lines containing and through sort.

cat logfile | mail uniqname - Mail the output of cat logfile to the user with the loginID uniqname.

Directory Maintenance

Wildcards

Selecting a subset of files within a directory to perform a command can be accomplished using reular expressions and wildcards. Common wildcards include the asterisk (*) and question mark (?). The asterisk can represent zero or more characters. The question mark represents exactly one character. Examples of these are as follows:

C* - Any file that begins with C.

?C* - Any file with a second letter as C.

prog*.C - Any file that begin with the letters prog and ends with a .C.

help*.d?? - Any file that begin the word help, and ends with .d and any two other characters.

*angle* - Any file that has the word angle in it.

Other infrequently used wildcards include the square brackets ( [ ] ) and the curly braces ( { } ). The square brackets are used to specify a range of characters such as the lowercase letters a through z with [a-z], or the numbers 0 through 9 with [0-9]. The curly braces select files that could contain one of a group of possible words such as either the word doc or txt with {doc,txt}. Examples follow:

[0-9]* - Any file that begins with a number.

*.{doc,txt,asc} - Any file with a doc, txt, or asc.

*[A-Z][A-Z]* - Any file that contains two uppercase letters.

{cat,dog}*.fm - Any file that begins the word cat or dog, and ends with .fm.

grep

Grep is a utility to search through one or more files for a string of text. Grep supports some aspect of regular expressions, but in its simplest form the syntax is as follows: grep 'string to search for' filename(s). The output of grep is the lines that contain the string. You may use wildcards for files. If a string has spaces or other characters that may be interpreted by the shell, you will need to put quotes around it. Also, if no file is specified grep will search through stdin, standard input. Now try out a few commands using grep:

grep animal * - Search through all files in the present directory for the word animal.

grep 'Chapter 2' *.doc - Search through all files that end in .doc for the string Chapter 2.

cat summer.txt | grep rose - Display the lines in the file summer.txt that contain the word rose.

ps -elf | grep uniqname - List only those processes that the user with the loginID uniqname has running.

find

The find command can be used to locate these files recursively in a directory structure. The find command has numerous options, but -name, -exec, and -print are the most common. With the find options, you can search for files by file names, file types, modification times and so forth.

The syntax of the find command is as follows: find directoryname options. To display the results of the find command, you need to include the -print option. Without this option, find will still function, but all found files will never be displayed to the screen. The -name option followed by a wildcard sequence or specific file name will instruct find to locate files that fit that file space. If you do use wildcards with the -name option, you must backslash them. If you do not backslash them, they will be interpreted by the shell and not passed on to find. The -exec switch is useful to perform a command on every found file (for example, -exec command {} command_options \; ). The curly braces indicate where find is to insert the actual file name found, the \; tells find where to terminate the command, and the text between them is the actual command that will be executed on each found file. Examples of the find command follow:

find . -name cisco -print - Search through the current directory as well as all directories under the current for files named cisco and print the results to the screen.

find . -name \?\?e\* -print - Search for any file that matches the wildcard ??e* or all files that have e as their third character and print the results.

find . -name \*.txt -exec cat {} \; - Search for all files that end in .txt and cat those files that match.

tar

Originally for tape archive, tar is now mainly used to consolidate a group of files and directories into one file, or to extract files from a previously tarred file. The way to consolidate a series of files in the current directory into a single file called cons.tar would be to use the command tar -cvf cons.tar *. Note that tar does not compress these files, it merely stores them into this one file. The switches at the front of the command are short for create/verbose/file. When you consolidate a series of files into a single tarred file, the originals are not deleted.

To extract the files from within the tarred file games.tar issue the command tar -xvf games.tar. All of the files and directories stored within games.tar would be extracted into the current directory. Tar will create directories while it is extracting so that the original hierarchy of files and directories are preserved upon extraction.

gzip/gunzip

These two utilities are responsible for compressing and expanding large files to save disk space; the syntax is very straightforward: gzip options filename or gunzip filename. Gzip compresses the given file. One option frequently used is the speed/size compression switch. This switch is a number -1 through -9. The -9 switch will compress the file into as small a file as the algorithm will support taking as much time as is necessary. The -1 switch will compress the file as quickly as possible at the cost of a little bit looser compression. Gzip will add a .gz extension to the original file, and upon completion, it will erase the original file.

A good candidate for compression is a tarred file. Frequently, you will see a file ending in .tar.gz or .tgz. This indicates a tarred file that also has been gzipped. Gunzip will uncompress a gzipped file. You do not need to specify any options here as the decompression will be calculated from the base file.

Aliases and the Bang Operator

There are a number of shortcuts available to make your Linux time more productive. Aliases allow you to create a command that executes another command, or set of commands, that you frequently type. For example, you could create the m command which types more for you. So now to view files you would type m filename as opposed to more filename. This saves a few keystrokes. There may be other situations in which you want to specify new commands that you are used to in another environment, for example, replacing cp with copy as in the DOS environment. To create an alias, type alias new_command old_command. It is a good idea to store your aliases is in your .cshrc file.

alias - List defined aliases.

alias dir ls -F - Define the alias dir as the command ls -F.

alias del rm - Define the alias del as the command rm.

alias copy cp - Define the alias copy as the command cp.

Another useful shortcut is the bang operator (!) or exclamation point. You can use this special character to retype a line or portion of a line that you have previously typed either just before this command line or further back in the history of your work. You can use the history command to list the last 20 or so commands that you have recently typed with a historical number next to each command.

Typing !! it repeats the last command you entered. If you type !num it will repeat the num-th command in your history. Also, using the !num command, you can specify a negative number which will retype the command num commands before the present one. !char looks for the last command starting with that character and retypes it. You may include more than one character to narrow down the search. Lastly, you may specify portions of a command to repeat. !:num will repeat the num-th parameter on the last command line. To repeat all of the parameters except the first you use !:*. Some examples follow:

echo a b c d e f - Display the characters a b c d e f.

!! - Repeat the previous command ( echo a b c d e f ).

clear - Clear the screen.

echo !:4 - Display the character d.

echo !:* - Display the characters a b c d e f (all of the parameters of the previous command).

history - Display all of the commands starting with the first echo.

!c - Repeat the clear screen command.

Startup and Customization Files (Dotfiles)

Startup and customization files provide an easy way to customize your login session. These customization files, which begin with a dot (.) as the first character, are referred to as dotfiles. They are automatically referenced by programs. For example, the .pinerc file is used by the Pine email program to set up default mail folders, printers, editor and so forth. It is important to make modifications with extreme care and never to delete any of these files!

Important dotfiles that exist in your account include .login and .cshrc. The .login file is sourced whenever you first log into a workstation. This file contains shell commands that may print messages, set up initial terminal specifications, set variables, or execute programs. The .cshrc file is sourced every time a shell is started. This is helpful for setting local environment variables. All of the standard CAEN dotfiles all reside in the /usr/local/skel directory and have the prefix std. To make sure you have all of CAEN's dotfiles in your account you can issue the redot (or /usr/caen/bin/redot) command.

Further Information

There is a wealth of information about Linux on the web. If you are interested in learning more about these operating systems, consult the online manual pages. Local bookstores also have many introductory books. Also feel free to contact the CAEN Hotline for general Linux questions.



What basic commands should I know in order to begin using Linux?

Below is a short list of basic Linux commands. Remember that online help via the man command is available for each of these commands. Simply type man command at the shell prompt.

General Commands

  • cd - Changes current working directory
  • cp - Copies a file
  • history - Lists previous commands executed
  • ln - Creates a link to a file/directory
  • ls - Lists contents of directory
  • mkdir - Creates a new directory
  • mv - Moves or renames files
  • pwd - Prints current working directory
  • rm - Removes files and links
  • rmdir - Removes a directory
  • !! - Repeats previous command

Archiving

  • compress - Reduces the size of a files/directories
  • tar - Archives files and directories
  • uncompress - Restores compressed files to their original form

Communications

  • finger - Displays information about a user or users
  • mail - Sends and receives electronic mail
  • scp - Securely copies files
  • sftp - Securely transfers files
  • ssh - Securely connects a user to a remote machine
  • who - Lists users who are logged into the machine
  • whoami - Prints current effective login ID (i.e. uniqname)

File Manipulation

  • apropos - Locates commands by keyword
  • awk - Scans and processes patterns
  • cat - Concatenates files
  • comm - Compares two files
  • diff - Displays differences between pairs of text files
  • find - Finds files
  • grep, egrep, fgrep - Searches a file for a pattern
  • head - Gives first few lines of file
  • man - Finds and displays information on commands and utilities
  • more, page, less - Display text files page-by-page
  • sed - Edits text from an input stream
  • tail - Displays the last part of a file
  • troff - Formats and typsets text

Process Control

  • bg - Places a stopped process in the background
  • fg - Places a stopped process in the foreground
  • jobs - Gives a list of current processes created from this shell
  • kill - Sends a signal to the specified process
  • ps - Gives process status
  • command & - Puts the process, executed by command, in the background

Miscellaneous

  • cal - Displays a simple text calendar
  • chmod - Changes file permissions
  • clear - Clears terminal screen
  • csh - Invokes a shell (command interpreter) with C-like syntax
  • date - Displays the date and time
  • du - Summarizes disk usage
  • hostname - Displays name of the current host system
  • script - Makes a transcript of a terminal sessions
  • sh - Invokes the Bourne shell
  • stty - Sets and displays terminal options
  • tset - Initializes a terminal
  • tty - Gets terminal name
  • umask - Sets/gets the default file permission mask
  • whatis - Describes what a command is
  • whereis - Locates a binary and/or manual page for program
  • which - Locates a program file, including aliases and paths

CAEN Utility Commands

  • hostinfo - Lists currently available lab machines
  • rmproc - Allows the console user to search for and remove remote processes
  • swselect - Allows users to streamline the process of customizing their environment to use new or old versions of software

AFS Commands

  • fs - Configures the AFS file system
  • pts - Allows users to create, examine, and modify AFS groups
  • gettokens - Allows the user to authenticate to an AFS cell, umich.edu by default, with a Kerberos password
  • tokens - Shows the user's AFS tokens
  • unlog - Removes the user's AFS tokens, disabling authenticated access to AFS files


What are dotfiles? How can I customize my dotfiles?

The set of files used to describe session initialization procedures and store user customizations are commonly referred to as dotfiles. These files are called dotfiles due to the fact that their names begin with a period (.). These files can be used to customize screen appearance, shell behavior, program specifications and other aspects of your Linux session. Most dotfiles are text files, although some exist in other formats. Dotfiles generally contain one command per line and are stored in your Public directory (linked-to from the home directory).

You may not have even noticed the dotfiles in your account because files that begin with a dot are not listed when the ls command is issued. To view your dotfiles, use the command ls -a. You may have many more dotfiles in your account than this example shows depending on what programs you have used and what, if any, customizations you have made to them. Many programs create dotfiles to store information and preferences, but you are given some dotfiles that are necessary for you to be able to login when you get your account.

	example% cd ~
	example% ls -a
	./          .gconfd          .mailcap     .pinerc
	../         .gnome           .metacity    .software
	.cshrc      .gnome-desktop   .mozilla     .ssh
	.gconf      .login           .nautilus    .xsession
	

To customize your dotfiles you can use any text editor, such as nedit, vi, or emacs. To make changes to the following files:

 

    	.login               - run once when logging into Linux machine
    	.cshrc               - run each time a new shell is opened
    	.xsession            - run once when logged into console of machine
    	

make sure that when you edit the above dotfiles, your code is correct csh shell syntax, or you may get an error and may not be able to log into Linux machines. If you think you have irrevocably damaged your dotfiles, you can reset them back to the CAEN default with the /usr/caen/bin/redot command. See Example (2) of the following FAQ for more information:

  • http://www.engin.umich.edu/caen/faqs/Accounts/CAEN/login/


What Linux shells are supported at CAEN?

CAEN only officially supports /bin/csh as a login shell. However, users can run other shells by making a few modifications to their dotfiles. For examples on running tcsh and bash, view the following Linux shell FAQ.



How can I run an alternate shell in the CAEN environment, such as tcsh or bash?

Shells other than /bin/csh are not supported as login shells at CAEN for two primary reasons: most do not come vendor-installed on any platform supported by CAEN, thus there is no guarantee that, for example, /bin/tcsh will be available on all machines; and CAEN does not have the resources or ability to provide customized /etc/passwd files on a per-machine basis for those who wish to have login shells other than /bin/csh.

However, CAEN does make certain shells, such as tcsh and bash, available for users. To run tcsh, for example, you can simply type tcsh at a command prompt. If you'd like tcsh to replace the current shell in a window, you can type exec tcsh instead.

If you feel that this is too much typing, you have a few options that can save you some time. One option for xterm users is to set up function keys to run tcsh. If the following lines are added to your .Xdefaults file, the F1 key will execute exec /bin/tcsh automatically in all your xterms:

    xterm*VT100.Translations: #override \
                F1: string("INDexec .shtmlbin/tcsh") string(0x0d) \n
    

If this is still too much typing for you, you can add the following to your .cshrc file (after the #!/bin/csh line) and tcsh will be run automatically. tcsh will simulate the correct behavior for login shells.

    if ((! $?tcsh) && $?prompt && ( -x /bin/tcsh )) then
    
       if (! $?comm) then
          set comm = `/bin/ps -fp $$ | tail -1 | awk '{ print $8 }'`
       endif
    
       if ("$comm" == "-csh") then
          exec /bin/tcsh -l
       else
          exec /bin/tcsh
       endif
    
    endif
    

Similarly, here is the analog to the tcsh startup for bash:

    if ($?prompt && ( -x /bin/bash )) then
    
       if (! $?comm) then
          set comm = `/bin/ps -fp $$ | tail -1 | awk '{ print $8 }'`
       endif
    
       if ( "$comm" == "-csh") then
          if ( -x "$HOME/.login" ) then
       source "$HOME/.login"
          endif
          exec /bin/bash --login
       else
          exec /bin/bash
       endif
    
    endif
    

For more information on xterms, take a look at the xterm man page by typing man xterm at a command prompt.



There is a large file named "core" in my home directory. Can I delete it?

The operating system writes out a memory image of a terminated process whenever certain errors occur. The most common reasons are memory violations, illegal instructions, bus errors, and user-generated quit signals. The memory image, a file named core, is written in the process's working directory.

This file can easily be removed with the rm command. However, if this is happening frequently, you will probably want to determine and fix the bug in your program that is causing this to occur. To find information about which program is dropping the core, type strings core | more. You should also read the man pages for core on the platform where the error is occurring.

You can use the command limit coredumpsize 0 to prohibit a core file from being created. Alternatively, you can create an empty directory named 'core' in your working directory. If the processor does try to create a core file, it will fail because there is already something there by that name which it can't overwrite.



My backspace key does not function correctly. How do I fix this?

At the Linux prompt, type stty erase backspace (where backspace is the desired key). You can also add this line to your .cshrc so the problem will be fixed for all future shells.

Type man stty for more information



How do I deal with file or directory names with spaces in them?

You can enclose the name in quotation marks, such as rm "Big File" or cd "EECS 105".



How can I find a file if I can't remember which directory it is in?

If you know the name and approximate location of the file that you want to find, you can use the find command to recursively search down through a directory. If you read the man page on the find command (type man find), you can become better acquainted with how powerful the command can be. To find a file that is located somewhere in a directory tree, you can use the following syntax:

find path -name 'filename' -print

If you want to search below the working current directory, you can substitute a . for the path. The filename specified after the -name parameter will be your search target. The -print option prints out the found entry. Remember, the order in which you put the parameters does matter. For example, if you put the -print parameter before the -name parameter, all the files being searched will be printed out and the file that you are looking for will not be marked.



How can I set up a symbolic link to a directory? How do I remove it?

To set up a symbolic link type

ln -s linktarget linkname

where linktarget is the directory to link to and linkname is the name of the symbolic link. You can type:

rm linkname

to remove the link. Type man ln for more information.



How can I set the Linux prompt to show what directory I am in?

First note that the current working directory is a shell variable. This variable can be referenced as $cwd. Using csh or tcsh, you can use some of the following commands to manipulate this variable. By itself it will print out the entire directory path, and some people may find this too long; type $cwd:t to print only the tail section. Then add these lines to your .cshrc file:


   if( ${?prompt} ) then
      alias setprompt 'set prompt = "[$cwd:t]> "'
      alias cd 'cd \!* ; setprompt'
      alias pushd 'pushd \!* ; setprompt'
      alias popd 'popd \!* ; setprompt'
      setprompt
   endif

This puts the tail of the current working directory in your prompt. You can also experiment with using other c-shell variables. Type set at the Linux prompt to list all your shell variables.

Tcsh has a couple of features to make this a bit easier. When it sees %/ in $prompt, it replaces it with the current working directory, and %C prints out just the trailing component. It also responds automagically to the alias cwdcmd whenever the working directory changes. So, to get the same effect as above in tcsh, add these lines to your .tcshrc file:


   if( ${?prompt} ) then
      alias setprompt 'set prompt = "[%c]> "'
      alias cwdcmd 'setprompt'
      setprompt
   endif

 



How do I uncompress a file with the .gz extension?

You can use the /usr/um/gnu/bin/gunzip program. If you run swselect and choose "GNU Compilers Utilities," log out and back in, then you will have access to many GNU programs, such as gunzip/gzip, gnu make, gnu tar, gawk, etc.



How do I extract the contents of a file with the .tar.Z or .tar.gz extension?

There are two methods you can use to extract the contents of a file. You can type:

    /usr/um/gnu/bin/gunzip filename.tar.Z
    tar -xvf filename.tar

or you can type:

    /usr/um/gnu/bin/zcat filename.tar.Z | tar -xvf -

The second method is more advantageous because you do not need to have space to store both the .tar.Z and the .tar files.



CSS 2.1 Valid
University of Michigan
  • Contact Us
  • Site Map
  • Site Feedback
  • Accessibility
  • Emergency Procedures
  • Jump to top of the page
© 2008 College of Engineering, University of Michigan
Last edited on: 11/13/2008