cheat sheet in english version

3
Sheet1 mv {oldfile} {newfile} mv {oldname} {newname} Cheat Sheet Linux apropos {keyword} Show which app will be run by default; it shows the full path Display man pages containing keyword man {command} man {command} > {filename} Redirect help to a file download Type man ls to read the manual for the ls command Search for all Unix commands that match keywords, eg apropos file Give short description of command (Not on RAIN) Whatis {command} which app man -k keyword whereis app time command man -t man | ps2pdf ->man.pdf dir {path} ls {path} | more ls {path} > {filename} ls -R {path} ls -F {path} Useful alias for DOS people, or use with ncftp. Show listing one sceer at a time Redirect directory to a file Recursive listing, with all subdirs. Show type of each file. “/” = directory, “*” = execute ls -a {path} ls -l {path} ls {path_1} {path_2} ls {path} Show all files, including important .dot files that don't otherwise show Long listing, with date, size, and permission List both {path_1} and {path_2}. It's ok to combine attributes, eg ls -laF gets a long listing of all files with types mkdir {dirname} Remove all files and subdirs. Careful! Only works if {dirname} is empty rm -r {dirname} rmdir {dirname} Make a new directory Show where you are as full patch. Usefull if you're lost o pwd Append newfile to end of oldfile Recursive, copy directory and all sudbirs. Copy from file 1 to file 2 cat {newfile} >> {oldfile} cp -r {dir1} {dir2} cp {file1} {file2} Remove a directory Print working directory Copy a file or directory Move (or rename) a file Moving a file and renaming it are the same thing. Help on any Unix command. RTFM! List a directory Change to directory Make a new directory Useful alias, like “cd ..”, or use with ncftp. Go back one directory Go back to home directory, useful if you're lost. There must be a space between cdup cd . . cd ~ cd {dirname} Show possible locations of app See how long a command takes Make a pdf of a manual page Page 1

Upload: fahmi-hamdani

Post on 13-Jul-2015

765 views

Category:

Education


2 download

TRANSCRIPT

Page 1: Cheat Sheet in English Version

Sheet1

mv {oldfile} {newfile}

mv {oldname} {newname}

Cheat Sheet Linux

apropos {keyword}

Show which app will be run by default; it shows the

full path

Display man pages containing keyword

man {command}

man {command} > {filename} Redirect help to a file download

Type man ls to read the manual for the ls command

Search for all Unix commands that match keywords,

eg apropos file

Give short description of command (Not on RAIN)Whatis {command}

which app

man -k keyword

whereis app

time command

man -t man | ps2pdf ->man.pdf

dir {path}

ls {path} | more

ls {path} > {filename}

ls -R {path}

ls -F {path}

Useful alias for DOS people, or use with ncftp.

Show listing one sceer at a time

Redirect directory to a file

Recursive listing, with all subdirs.

Show type of each file. “/” = directory, “*” = execute

ls -a {path}

ls -l {path}

ls {path_1} {path_2}

ls {path}

Show all files, including important .dot files that don't

otherwise show

Long listing, with date, size, and permission

List both {path_1} and {path_2}.

It's ok to combine attributes, eg ls -laF gets a long

listing of all files with types

mkdir {dirname}

Remove all files and subdirs. Careful!

Only works if {dirname} is empty

rm -r {dirname}

rmdir {dirname}

Make a new directory

Show where you are as full patch. Usefull if you're lost or exploringpwd

Append newfile to end of oldfile

Recursive, copy directory and all sudbirs.

Copy from file 1 to file 2

cat {newfile} >> {oldfile}

cp -r {dir1} {dir2}

cp {file1} {file2}

Remove a directory

Print working directory

Copy a file or directory

Move (or rename) a file

Moving a file and renaming it are the same thing.

Help on any Unix command. RTFM!

List a directory

Change to directory

Make a new directory

Useful alias, like “cd ..”, or use with ncftp.

Go back one directory

Go back to home directory, useful if you're lost.

There must be a space between

cdup

cd . .

cd ~

cd {dirname}

Show possible locations of app

See how long a command takes

Make a pdf of a manual page

Page 1

Page 2: Cheat Sheet in English Version

Sheet1

rm {filespec}

ls {filespec}

rm {filespec}

more {filename} View file one screen at a time

less {filename} Like more, with extra features

cat {filename} View file, but it scrolls

cat {filename} | more View file one screen at a time

page {filename} Very handy with ncftp.

pico {filename} Use text editor and don't save.

pico {filename}

Cat > {filename}

pico {filename} Create some text and save it.

diff {file1} {file2} Show the differences

sdiff {file1} {file2} Show files side by side

grep '{pattern}' {file} Find regular expression in file

sort {file1} > {file2} Sort file1 and save as file2

sort -o {file} {file} Replace file with sorted version

spell {file} Display misspelled words

wc {file} Count words in file

find {filespec} Works with wildcards. Handy for snooping.

find {filespec} > {filename} Redirect find list to file. Can be big!

alias {name} '{command}'

{command} > {file}

{command} >> {file}

{command} < {file} Get input from a file, eg sort < file.txt

{command} < {file1} > {file2}

{command} | {command}

Edit a text file

The same editor PINE uses, so you already know ir.

vi and emacs are also available

Enter your text (multiple lines with enter are ok) and

press control-d to save

Create a text file

? and * wildcards work like DOS should. “”?” is any

cha; “* is any string of char

Good strategy : first list a group to make sure it's

what's you think...

… then delete it all at once

Delete a file

View a text file

Compare two files

Other text commands

Find files on system

Put the command in 'single quotes'. More useful in

your .cshrc file

Make an alias

Pipe one command to another, eg ls | more gets

directory and sends it to more to show it one page at

a time

Get input from file1, and write to file2, eg sort <

old.txt > new.txt sorts old.txt and saves as new.txt

Append output to an existing file, eg cat update >>

archive adds update to end of archive

Redirect output to a file, eg ls > list.txt writes

directory to file

Pipes and Redirection

Page 2

Page 3: Cheat Sheet in English Version

Sheet1

finger {userid} Find out what someone's up to

gopher Gopher

irc IRC, but not available on RAIN

lynx Text-based Web-Browser, fast and lean

ncftp Better FTP

pico {filename}

pine Email

telnet {host} Start telnet session to another host

tin Usenet

uudecode {filename} Do it on the server to reduce download size

uuencode {filename} About 1/3

ytalk {userid} Chat with someone else online, eg ytalk mkummel.

date Show date and time

df Check system disk capacity

du

More / etc / motd Read massage of the day, “motd” is a useful alias..

printenv

quota -v Check your total disk use

uptime Find out system load

w Who's online and what are they doing?

cal Show this month

whoami Who you are logged in as

finger user Display information about user

uname -a Show kernel information

cat/proc/cpuinfo CPU information

cat/proc/meminfo Memory information

free show memory and swap usage

grep pattern files Search for pattern in files

grep -r pattern dir

locate file Find all instance of file

find/ -name filename

find/ -name "*filename*"

locate filename Find a file called filename using the locate

updatedb

which filename

grep TextStringToFind /dir

Application I use

Easy text editor, but limited vi and emacs are

available

Show all environmental variables (in C-shell% - use

set in Korn shell$)

Chech your disk usage and show bytes in each

directory

System info

Search recursively for pattern in the output of

command

Searching

Starting with the directory called dir, look for and list

all files containing TextStringToFind

Show the subdirectory containing the executable file

called filename

Create or update the database of files on all file

systems attached to the linux root directory

Starting with the root directory, look for the file

containing the string filename

Starting with the root directory, look for the file called

filename

Page 3