Friday, May 27, 2011

linux commands

Some of these are specific to the bash shell. I have not experimented enough with other shells to know which are common to all shells. See also the ``Bash Reference Card'', SSC (2000), available online.

/ - root directory

./ - current directory

./command_name - run a command in the current directory when the current directory is not on the path

../ - parent directory

~ - home directory

$ - typical prompt when logged in as ordinary user

# - typical prompt when logged in as root or superuser

! - repeat specified command

!! - repeat previous command

^^ - repeat previous command with substitution

& - run a program in background mode

[Tab][Tab] - prints a list of all available commands. This is just an example of autocomplete with no restriction on the first letter.

x[Tab][Tab] - prints a list of all available completions for a command, where the beginning is ``x''

[Alt][Ctrl][F1] - switch to the first virtual text console

[Alt][Ctrl][Fn] - switch to the nth virtual text console. Typically, there are six on a Linux PC system.

[Alt][Ctrl][F7] - switch to the first GUI console, if there is one running. If the graphical console freezes, one can switch to a nongraphical console, kill the process that is giving problems, and switch back to the graphical console using this shortcut.

[ArrowUp] - scroll through the command history (in bash)

[Shift][PageUp] - scroll terminal output up. This also works at the login prompt, so you can scroll through your boot messages.

[Shift][PageDown] - scroll terminal output down

[Ctrl][Alt][+] - switch to next X server resolution (if the server is set up for more than one resolution)

[Ctrl][Alt][-] - change to previous X server resolution

[Ctrl][Alt][BkSpc] - kill the current X server. Used when normal exit is not possible.

[Ctrl][Alt][Del] - shut down the system and reboot

[Ctrl]c - kill the current process

[Ctrl]d - logout from the current terminal

[Ctrl]s - stop transfer to current terminal

[Ctrl]q - resume transfer to current terminal. This should be tried if the terminal stops responding.

[Ctrl]z - send current process to the background

reset - restore a terminal to its default settings

[Leftmousebutton] - Hold down left mouse button and drag to highlight text. Releasing the button copies the region to the text buffer under X and (if gpm is installed) in console mode.

[Middlemousebutton] - Copies text from the text buffer and inserts it at the cursor location. With a two-button mouse, click on both buttons simultaneously. It is necessary for three-button emulation to be enabled, either under gpm or in XF86Config.

3 Typical Dot Files

There is some redundancy across these programs. For example, the look and behavior of emacs can be customized by usinng the .emacs file, but also by adding the appropriate modifications to the .Xdefaults file. Default versions of these files are often installed in users' home directories when the software packages that use them are installed. If a program doesn't find its configuration file in the user's home directory, it will often fall back on a sytem-wide default configuration file installed in one of the subdirectories that the package lives in.

.bash_logout - file executed by bash shell on logout

.bash_profile - initialization of bash shell run only on login. Bash looks first for a .bash_profile file when started as a login shell or with the -login option. If it does not find .bash_profile, it looks for .bash_login. If it doesn't find that, it looks for .profile. System-wide functions and aliases go in /etc/bashrc and default environment variables go in /etc/profile.

.bashrc - initialization command run when bash shell starts up as a non-login shell

.cshrc - initialization commands that are run automatically (like autoexec.bat) when C shell is initiated

.emacs - configuration file for emacs editor

.fvwmrc - configuration file for fvwm window manager

.fvwm2rc - configuration file for fvwm2 window manager

.jedrc - configuration file for the jed text editor

.lessrc - typically contains key bindings for cursor movement with the less command

.login - initialization file when user logs in

.logout - commands run when user logs out

.wm_style - gives choice of default window manager if one is not specified in startx

.Xdefaults - sets up X resources for individual user. The behavior of many different application programs can be changed by modifying this file.

.xinitrc - initialization file when running startx. Can be used to activate applications, run a given window manager, and modify the appearance of the root window.

.xsession - configuration file for xdm

0 comments:

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Hosted Desktops