WTLUG //


 
    Home  ·  Archive  ·  About  ·  Authors  ·  Hall of Fame  ·  Calendar  ·  Admin

Wednesday, Jul. 23rd, 2008

    Got some news? Let us Know!
    Submit a story!

    Navigation:

  [Features]   [Reference]   [Utils]   [Sections]

    Last 10 Items:

Linux Hints:

Keyboard Shortcuts, Vi Commands, Linux Commands

by Shortbus

Keyboard Shortcuts:

Shortcut (Key Sequence) Explanation of shortcut
Ctrl + c stops the process/command being run from that particular terminal and returns you to the command prompt
Ctrl + d stops all commands being run when pressed once; logs you out of X when pressed twice
Ctrl + y ends a process/command and allows you to return to the command prompt to see what you were doing
Ctrl + s stops all transfer to the terminal
Ctrl + q resumes all transfer to the terming (useful if a terminal dies or stops responding)
Ctrl + h erases a character from the command line
Ctrl + u deletes an entire string from the command line
Ctrl + w deletes an entire word from the command line
Ctrl + l OR Ctrl + r refreshes the terminal
Ctrl + z send current process to the background
Ctrl + Alt + f1 switch to the first text terminal
Ctrl + Alt + fn (f1 - f6) switch to any of the first 6 text terminals (numbers correspond: f1 = 1st text term; f2 = 2nd text term; etc..)
Ctrl + Alt + f7 switch to the first GUI (graphical user interface) terminal/window (netscape, cd player, etc...)
Ctrl + Alt + fn (f7 - f12) switch to any of the first 6 GUI terminals/windows (numbers correspond: f7 = 1st GUI term; f2 = 2nd GUI term, etc...)
Ctrl + Alt + (+) changes to the next established/configured resolution for your system (assuming you have more than one res. configured)
Ctrl + Alt + (-) reverts to the previous established/configured resolution
Ctrl + Alt + Delete reboots your machine
Ctrl + Alt + Backspace logs you out of X
tab auto-completes commands and/or paths on a command line
up arrow scrolls through the previously issued commands for editing purposes or reissue of any given command
Shift + PageUp scrolls terminal output up
Shift + PageDown scrolls terminal output down
reset will restore a screwed up terminal if for some reason you are unable to decipher any of the output for that terminal (seeing gibberish and binary-like characters)

Vi Commands:

Vi Commands Explanation of commands (some commands may require capitalization in order to function properly)
vi filename puts you in the vi text editor so that you can create/edit files; you will enter in the 'browse' mode; there are two modes, 'insert' and 'browse'
:q! quits vi without saving any of the changes made (browse mode)
i when in vi, this will place you in 'insert' mode which will allow you to add, edit, remove information from the file (browse mode)
set showmode sets vi to display the mode of operation you are in (browse mode)
Esc takes you out of 'insert' mode and places you in 'browse' mode (insert mode)
Ctrl + u erases the current line you are hovering (insert mode)
Ctrl + h erases the current character you are hovering (insert mode)
Ctrl + w erases the current word/string you are hovering (insert mode)
h moves the cursor left (browse mode)
j moves the cursor up (browse mode)
k moves the cursor down (browse mode)
l moves the cursor left (browse mode)
u undoes the last selection/modification (browse mode)
x deletes the character you are hovering (browse mode)
dw deletes the word/string you are hovering (browse mode)
dd deletes the entire line that you are hovering (browse mode)
D deletes the entire line that you are hovering (browse mode)
ZZ saves any edits you have made and exits vi (browse mode)
Ctrl + l redraws screen
:wq saves any changes made to the file and exits vi

Linux Commands:

Linux Commands Usage Explanation of commands (some commands may require full paths; some may not work on your system at all)

~~~~~~Text Editing/Viewing~~~~~~

less filename less list.txt displays the contents of a file and allows you to view them one page at a time
more filename more list.txt displays the contents of a file and allows you to view them one page at a time
cat filename cat list.txt OR cat accounts displays the contents of a file or folder
pico filename pico list.txt text editor that allows you to view and edit files
emacs filename emacs list.txt text editor that allows you to view and edit files
vi filename vi list.txt much like pico and emacs, but much more powerful and versatile
ed filename ed list.txt text editor, much like pico and emacs
head filename head list.txt displays the first 10 lines of a file
tail filename tail list.txt displays the last 10 lines of a file
sort filename sort list.txt displays the contents of a file in a sorted order

~~~~~~File Editing/Management~~~~~~

rm filename rm trash.pl removes/deletes a file
rm -rf filename rm -rf trash removes a directory as well as any files/folders contained within the specified directory
cp filename cp list.txt ~pengen/list.txt.bak copies files, either within the same directory or to another directory
mv fileA fileB mv list.txt list.txt.bak moves/renames files
mkdir directoryname mkdir newfolder creates new directories
rmdir directoryname rmdir oldfolder deletes a directory (directory must be empty for this to work)
ln filename new -link ln cgi-bin new -link creates a hard link to an existing file
ln -s filename new -link ln -s cgi-bin new -link creates a soft link to an existing file

~~~~~~File Listings/Information~~~~~~

info info OR info netscape displays information about shells, programs or utilities (you have to specify what you want info on)
grep string filename grep domain.com /var/www/conf will search a file or folder(s) for a specific instances of words or strings
diff fileA fileB diff list.txt some.mp3 will display the differences between two files
file filename file list.txt displays information about a file and its contents
stat filename stat list.txt displays statistical information about a file and its contents
dir dir lists the contents of the directory you are in
vdir vdir lists the contents of the current directory as well as any file attributes
wc filename wc list.txt will count the number of characters, words, lines in a file
cmp fileA fileB cmp list.txt some.mp3 will list the first place where fileA and fileB differ from one another
ls see below for SOME examples lists contents of the current directory
ls -a lists all files
ls -l long listing, includes file attributes
ls -al lists all files and their attributes
ls -s lists all files and rounds their size to nearest kilobyte
ls -S lists files according to size
ls -C list displays in columns (if current terminal size allows)
ls -F places a symbol next to files to indicate file type
ls -r lists files in reverse order
ls -R recursive listing, includes not only files directly within current directory, but also files contained in any subdirectories
ls -t lists files according to their time stamps
ls *.mp3 (or other file extension) lists all files matching the specified extension

~~~~~~Compression/Decompression~~~~~~

gzip filename gzip mp3s compresses a file/folder
compress filename compress mp3s compresses a file/folder
zcat filename zcat mp3s.gz displays the contents of a compressed file
gunzip filename gunzip mp3s.gz decompresses a compressed file
tar -zxvf filename tar -zxvf mp3s.tar.gz will decompress a tar'ed and compressed file

~~~~~~Remote Connections~~~~~~

rlogin hostname rlogin remote.host.net utility used to connect to a remote computer
telnet hostname telnet remote.host.com utility used to connect to a remote computer, must more interactive than rlogin
ftp hostname ftp domain.com utility/protocol used to transfer files from a local computer to a remote computer and visa-versa
ssh hostname ssh brahill@fifth.mspring.net used much like telnet or rlogin to connect to a remote computer, only it is done in a much more secure manner

~~~~~~Printing~~~~~~

lpr filename lpr list.txt sends a file to the printer queue
lpq lpq displays a list of files in the printing queue
lprm filename lprm list.txt removes a file/job from the printing queue

~~~~~~System Management~~~~~~

dmesg dmesg displays the kernel ring buffer
df df displays all mounted file systems
ps ps reports process status for a processes being run out of a specific terminal
command & gaim & OR netscape & sends a job/process to the background when you run it, it is then assigned a process number and it takes a lower priority in processing/memory usage
top top displays an updating list of running processes
tty tty displays the name of a terminal in what a process/command was issued as well as the path
jobs jobs displays a list of current running processes for a specific terminal
kill PID or job # ??? aborts the specified process by PID or job #
du du shows amount of memory being used and by what
ifconfig ifconfig OR /sbin/ifconfig gives you the configuration info for your machine (network configurations and so forth)
nice command nice netscape runs a process/command at a lower priority so it takes less of a toll on system resources

~~~~~~Useful Commands~~~~~~

passwd passwd follow steps after that change the password for the current user
man command man more OR man displays the linux manual pages for a specific command (enter just 'man' for more assistance')
xman xman displays the linux manual pages in X (essentially a GUI)
clear clear clears a full or cluttered terminal
pwd pwd present working directory, will show what directory you are in by the path
apropos command apropos more searches all of the man page topics/headings for the specified command and lists any relevant man pages
lynx lynx alienated.org text based web browser
whoami whoami tells you whatever user it is that you are logged in as
which command which traceroute displays the path to the specified command
locate command locate traceroute works the same as which, will show you the path to the specified command
whereis command whereis traceroute displays the path to the command, its binary source and its man page(s)
who who lists all users currently logged in to a given computer (try this on fifth, for example)
w w lists all users currently logged in to a given computer and the processes they are running
hostname hostname displays the systems hostname
find folder file find ~pengen/ list.txt will search the entire computer ( / ), or just a specified folder (and all subfolders), for a specific file
cd foldername cd /var/conf/www changes to a specific directory
cd .. cd .. changes to the directory one level up
date date displays the date and time
cal cal or cal 2000 displays the calendar for the current month or for a specified year
help help will display a list of topics in which this command can help you locate more information on
chfn chfn follow instructions allows you to change the 'finger' information for your computer under the current login
finger user finger brahill will retrieve information about a specified user
chage user chage pengen will set an expiration date on a users password, can only be used by someone with root access (please don't ask what root is, if you do, I will find you and laugh at you heartily, I'll bring a camera too, and people...I swear it!)

FTP Commands:

FTP Command Usage Explanation of the commands (I'm not too clear on how to use all of these commands, press enter at your own risk!)
! ! escapes back to the shell/bash prompt
$ macro $ macroname executes a macro for use with the ftp session
account send account command to the remote system
append appends to a file
ascii ascii sets the ftp session to transfer files in ascii mode
bell bell toggles the command completion sound off/on
binary binary sets the ftp session to transfer files in binary mode
bye bye used to terminate and exit an ftp session
case case toggles mget upper/lower case id mapping
cd directory cd www change remote working directory
cdup cdup change remote working directory to the parent directory
chmod 755 filename chmod 755 script.pl change the permissions of a file/folder on the remote system
close close terminate an ftp session
cr cr toggle carriage return stripping on ascii gets off/on
delete filename delete script.pl.old delete a file or an empty folder
debug debug toggle/set debugging mode
dir dir lists contents of current working remote directory
disconnect disconnect terminate an ftp session
exit exit terminate and exit an ftp session
form form set file transfer format (ascii/binary)
get filename get script.pl receive a file from the remote system
glob glob toggle metacharacter expansion of local filenames off/on
hash hash toggle printing '#' for each buffer transferred off/on
idle idle get/set the idle timer on the remote system
image image sets the transfer mode to binary
lcd localdirectory lcd ~home/thisfolder change local working directory
ls ls lists contents of current remote directory (see HERE for more options with this command)
macdef defines a macro
mdelete fileA fileB mdelete funk.pl funk.pl.bak deletes multiple remote files
mdir dirA dirB mdir www cgi-bin lists the contents of multiple remote directories
mget fileA fileB mget bad.pl badder.pl gets multiple remote files
mkdir dirname mkdir www make a directory on the remote machine
mls dirA dirB mls www cgi-bin lists the contents of multiple remote directories
mode mode set file transfer mode (binary/ascii)
modtime filename modtime index.html shows the time when a specific remote file was last modified
mput fileA fileB mput new.html sound.rm uploads multiple files to the remote system
newer filesname newer index.html get file if the remote file is newer than the local file
nmap set templates for default name mapping
nlist nlist list contents of current working remote directory
ntrans set translation table for default name mapping
open connect to remote tftp
pass pass toggles passive mode off/on
passive passive toggles passive mode off/on
prompt force interactive prompting for multiple commands
proxy issue command on alternate connection
sendport toggle use of PORT command for each data connection
put filename put index.html send one file to the remote system
pwd pwd present working directory on remote system
quit quit terminate and exit ftp session
quote send arbitrary ftp command
recv filename recv index.pl receive one file from the remote system
reget filename reget database.txt get a file restarting at the end of a local copy of the same file (kind of like 'resume transfer')
rstatus rstatus show status of remote system
rhelp rhelp get help from the remote system
rename filename newfilename rename index.pl index.pl.old renames the specified file
reset reset clear queued command replies and blank the terminal output
restart restart restarts the last file transfer at bytecount
rmdir directoryname rmdir www remove a directory on the remote system
runique runique toggle store unique for local files
send filename send index.pl send one file
site send site specific command to the remote server
size filename size database.txt show the size of the remote file
status status show current status of the remote system
struct set file transfer structure
system system show remote system type
sunique sunique toggle store unique on remote system
tenex tenex set tenex file transfer type
tick toggle printing byte counter during transfers
trace toggle packet tracing
type type set file transfer type (binary/ascii)
user user send new user information
umask umasgk get/set umask on remote system
verbose verbose toggle verbose mode off/on

Expanding This Document:

So I finally did something helpful, and to continue my show of selflessness, I will offer each and every one of you the chance to help me make this as complete a 'Linux Help' document as possible. If you see something on here that needs to be edited or expounded upon, please let me know and I'll get on it. If you know of a command or two that NEED to be on this page, let me know and I'll get to adding. If you think I'm a pompous....never mind, I don' want to know. If you know of any particular subject/command/process or whatever that needs it's own section...well, in that case, do a little of the leg work for me, and I'll add that too. Just to give you all a heads up, this is not the final form of this here help thingy, I'll be adding new features/sections very soon (I have to keep myself busy somehow, don't I?)...things I'm already working on: a semi-complete explanation of command line FTP and the commands used; a section on DNSvi commands; a section on telnet commands/ports; I'm also trying to narrow down what commands work for what OS's. If you have any suggestions, please email me at aphex_web@earthlink.net


    New Members:

Page created in 0.74 seconds.