The Linux Cheatsheet

Conventions

* listings are useful to root (or limited to root).


Conventions - Modifier keys

cmd = command or windows key

opt = alt, option, or meta key

sft = shift key

ctrl or ^ = ctrl

l prefix = left (e.g. left shift)

r prefix = right (e.g. right shift)


Conventions - Key separators

- = press these together (e.g. cmd-q = hold cmd & Q together, then release both

, = press in order (e.g. press ctrl-x, then ctrl-c)


Shell prompt

clear = clear screen and put prompt at top

command command args = run command w/ args as its parameters, ignoring aliases

date = put system date to stdout (\d in $PS1 is recommended instead)

*rdate server = sync with server via NTP (I recommend tock.usno.navy.mil)

*uptime = put how long the system has been up to stdout

*free = how much memory is available


Shell prompt - Shells

bash = Bourne Again SHell

pdksh = Public Domain Korn SHell (aka ksh)

tcsh = TENEX C SHell

sh = bourne SHell

zsh = (no meaning)

mc = Midnight Commander - not CLI, rather like DOS Shell actually

pilot = Pine's Internal Lister of Things - fewer extras than mc; incl'd w/ pine


Shell prompt - IP

nslookup host = resolve host (could be either a hostname or IP)

nslookup host DNS = resolve host using given DNS

ping host = send an ICMP ping to host

whois hostname = whois this hostname (rs.internic.net)


Shell prompt - Power on/off

*shutdown -h now = shutdown immediately

*shutdown -r now = shutdown and restart immediately

*shutdown -h/-r minutes = shutdown and restart in minutes


Shell prompt - Users and Logins

*who = see who is on the system

write person = send a message to person (ctrl-D to end)

mesg boolean = set whether you can be written to (y or n)

login = login again (does not kill your previous shell)

su = same as above with "root" for username

logout = logout and disconnect your session

exit = quit the non-login and/or Korn shell (same as kill -9'ing its PID)


Shell prompt - File manipulation

cd folder = switch to folder

folder = /folder = folder "folder" at the top level

folder = folder = folder "folder" in .

folder = . = current folder

folder = .. = folder that is one level higher

folder = ~ = home directory (as defined in $HOME)

folder = ~user = user's home directory

 

pwd = put working directory (use sh \w, csh %~, or ksh $(pwd) in $PS1 instead)

 

ls -AdFkl folder = show infomation on folder (which of course could also be a file)

ls -ABCF = multicolumn list of all files, folders, and links except . and ..

ls -ABFkl = long (1-col) list of all files, folders, and links except . and ..

ls -Al|wc -l = count files/folders

ls -Al folder|wc -l = count files/folders in folder

 

touch -r file time = set modification date of file to time (now if omitted)

 

chmod user[+-=]permissions file = set permissions for user of file to permissions (see Symbolic Permissions below)

chmod octal file = set permissions of file to octal (see below)

chown user file = give file to user - to get it back they must give it back!

chown user:group file = give it to group as well

 

mv file file = rename file1 to file2

mv file folder = move file to folder

mv file folder/file = move file1 to folder, then rename it to file2

 

cp source dest = copy source to dest (e.g. cp ~/risebox/cheatsheet.txt ~)

cp -a source dest = exact copy

 

ln -s source target = create a symbolic link (alias, shortcut) to source at target

ln source target = create a hard link - needed for applications

 

grep pattern = search for pattern in the text piped to grep (see below)

grep -f file = search for the patterns in file in the text piped to grep

 

cat file1 file2 = append file2 to file1 and put the result to stdout

cat file = display file uninterrupted

 

less -M file = display file (see below for paging cmds)

less -M = display whatever is piped to less

 

head file = display the first 10 lines of file

tail -f file = display the last 10 lines of file, adding as the file grows

wc -l file = count lines in file

wc -w file = count words in file

wc -c file = count characters in file

wc --bytes file = file size for file in bytes

echo "`wc --bytes file` \* 1024" | bc = ...in kilobytes

echo "`wc --bytes file` \* 1024 \* 1024" | bc = ...in megabytes


Shell prompt - Symbolic permissions

u = user who owns the file

g = group that owns the file

o = Public At Large (others)

a = all of the above

+ = add given permissions, ignore others

- = revoke given permissions, ignore others

= = set permissions absolutely (add specified perm's and revoke any others)

r = read

w = write

x = execute

s = user/group ID bit; process owner == file owner (instead of the user opening the file)

t = sticky bit; contents stay in memory until pushed out by disuse

chmod a=rwx,o-w file.txt = sets permissions of file.txt to rwx for file owner and his group, but only rx for anyone else

chmod a=rwx,o-w,u+s file.txt = sets permissions of file.txt as above, but anyone who runs it will have the same access as the file owner (IOW, file owner = process owner) - so watch out if owner is root

octal is usually more efficient, and NEVER set your shell +s! this gives anyone with an account root access without being root!


Shell prompt - Octal permissions

down = permission

across = position in octal number (from right)

1 2 3 4

1 o+x g+x u+x o+t, sticky bit (prog is cached in RAM; faster reload)

2 o+w g+w u+w g+s, if g+x, group ID (group=process owner), else lock

4 o+r g+r u+r u+s, if u+x, user ID (file owner = process owner)

total number at left to get permission to set - a=rwx is 777; u=rwx,o=r is 704

add 4th digit for sticky/[UG]ID bits, e.g. a=rwx,u+s = 4777


Shell prompt - Environment

alias name=value = alias name to value (typing name then executes value)

alias name = display the alias name

unalias name = delete alias

typeset -x variable=value = set variable to value

variable=value;export variable = same as above

typeset = show environment (all variables)

set = same as typeset

env = same as typeset, but doesn't show as many


Shell prompt - Environment - PS1 (prompt) - Bourne (sh/bash)

\d = date

\h = machine name

\H = entire hostname

\n = newline

\! or \# = how many cmds you've executed so far (including login and this one)

\s = the name of the current programme, i.e. the shell

\t = time (24-hr)

\T = time (12-hr) - bash 2.0 only

\@ = time (AM/PM) - bash 2.0 only

\u = $LOGNAME

\w = working directory

\\ = backslash (\)

\nnn = the character expressed by octal nnn (see ASCII character list below)


Shell prompt - Environment - PS1 (prompt) - C (csh/tcsh)

%d %w %D = date (same as bash \d; add %Y for year)

%m = machine name

%M = entire hostname

%B and %b = begin/end boldface

%U and %u = begin/end underline

%S and %s = begin/end inverse (standout mode)

%! or %h = how many cmds you've executed so far (including login and this one)

%T = time (24-hr)

%P = time (24-hr w/ secs)

%t or %@ = time (12-hr)

%p = time (12-hr w/ secs)

%n = $LOGNAME

%~ = working directory (equivalent to bash)

%c0n = last n (default 1) segments of the working dir; if 0 is present, replace missing parts with "/skipped" e.g. "/skipped/boredzo"

%% = percent sign (%)

\nnn = the character expressed by octal nnn (see ASCII character list below)


Shell prompt - Environment - PS1 (prompt) - Korn (ksh/pdksh)

...has no PS1 variables. use command or variable substitution instead (see Korn Shell Script below)


Shell prompt - Processes

ps = show all your open processes

ps aux|grep pattern = list all processes matching pattern

nohup command = execute command without killing it on logout

kill PID = kills (terminates) the process marked PID (according to ps)

*kill -9 PID = force-kills the process marked PID (according to ps) using SIGKILL - equivalent to Mac cmd-opt-esc or DOS ctrl-alt-del

the process does not get to clean up after itself; USE WITH CAUTION!!!

you can (and very probably will) lose data this way!

screen command = start screen and execute command within it (sort of a shell)

ctrl-A,d = detach a process launched with the above method

screen -r = reattach all processes bkgnd'd with the above sequence

(to detach = to suspend output to stdout; reattach = resume it again)

(this effectively "hides" an application, and in a lot of cases can be better than command &)

command & = executes command and backgrounds it

fg = resume all suspended (&'d) cmds

crontab -e = edit your crontab schedules


Shell scripting (Bourne and Korn)

test -e file = file exists

test -x file = ...and is executable

test -w file = ...writable

test -r file = ...readable

test -s file = ...not empty

test -d file = ...a directory

test -f file = ...a regular file (not a device driver or directory)

test text1 = text2 = test whether text1 is the same as text2 (string)

test text1 != text2 = test whether it isn't (string)

[ expression ] can also be used instead of test expression

Korn shell recommends you use [[ expression ]] instead of either

break = exit from a loop

echo text = display text on the screen

echo -n text = display text but don't put a newline after it

echo -e text = display text and look for these wildcards:

\n = newline

\t = tab

\a = alert (system beep character, ctrl-g - see ASCII character list)

\0nnn = character with octal value nnn (see ASCII character list)

\\ = a backslash

print text = same as echo -e, for ksh (use print -r to emulate echo)

print -un text = print to file descriptor n (ksh only)

print -r text = print to file descriptor n (ksh only)

read variable = assign 1 line of user input to $variable

if commands

then

commands

elif

commands

then

commands

else

commands

fi = determines the result of a command(s) and executes other commands based on it (elif and else are optional)

case text in

pattern) commands;;

pattern) commands

morecommands;;

...

esac = determine whether text matches pattern, pattern, etc. and act on it (often used with read for a prompt)


Regular expressions (patterns)

. = any character except \000 ("") or \n (newline)

* = 0 or more times

+ = 0 or 1 times

? = 1 times

[characters] = any of characters

^ (at beginning of character class) = all BUT the chars in the class

- = range (e.g. [0-9a-zA-Z] searches for all alphanumeric chars)

(pattern) = search for a subpattern (e.g. [(fools)(fool's)] gold)

\ = escape character (don't parse it) - e.g. \. searches for a period

^ (at beginning of pattern) = search only at start of line

$ (at end of pattern) = search only at end of line

{number} = number instances of preceding char, separated by commae

{,number} = no more than number instances

{number,} = no fewer


less - Paging Commands

b = go backward one screen

f = go forward one screen

space = same as f

up = go backward one line

down = go forward one line

e = launch $EDITOR (usu. ed)

v = launch $VISUAL (def. vi, but emacs recommended)

p,percentage = go to percentage of the file

/,pattern = search for pattern


ASCII character list

dec. hex. oct. char. name funct.

0 0 \000 ^@ NULL empty string

1 1 \001 ^A SOH start of header

2 2 \002 ^B STX start of text

3 3 \003 ^C ETX end of text, usu. used for "quit process" (= Cmd-Q on Mac or ^X on Windows)

4 4 \004 ^D EOT end of stream (or file)

5 5 \005 ^E ENQ a sort of ping

6 6 \006 ^F ACK positive acknoledgement (yes, true)

7 7 \007 ^G BELL produce a system beep

8 8 \010 ^H BS backspace

9 9 \011 \t HT horiz. tab

10 A \012 \n LF linefeed - used alone on Linux, and after CR on DOS, to break a line

11 B \013 ^K VT vert. tab - move the cursor down 1 and to the left, w/o breaking the text

12 C \014 ^L FF formfeed - scroll the terminal its full length, effectively clearing it

13 D \015 \r CR carriage return - used alone on Mac, and before LF on DOS, to break a line

14 E \016 ^N SO "shift out" of an alternate charset

15 F \017 ^O SI "shift in"to the same

16 10 \020 ^P DLE data link escape (?!)

17 11 \021 ^Q DC1 resume output after a DC3

18 12 \022 ^R DC2 resume output after a DC4

19 13 \023 ^S DC3 suspend output until a DC1

20 14 \024 ^T DC4 suspend output until a DC2

21 15 \025 ^U NAK negative acknowledgement (no, false)

22 16 \026 ^V SYN synchronous idle (?!)

23 17 \027 ^W ETB end transmission block (?!)

24 18 \030 ^X CAN cancel

25 19 \031 ^Y EM end of medium (?!)

26 1A \032 ^Z SUB substitute (presumably next char., doesn't usu. work in practice tho)

27 1B \033 ^[ ESC escape - does any number of things

28 1C \034 ^\ FS file separator - presumably an alternate to EOT

29 1D \035 ^] GS group separator (?!)

30 1E \036 ^^ RS record separator (?!)

31 1F \037 ^_ US unit separator (?!)

32 20 \040 space SPC one horizontal character space

33 21 \041 !

34 22 \042 "

35 23 \043 #

36 24 \044 $

37 25 \045 %

38 26 \046 &

39 27 \047 '

40 28 \050 (

41 29 \051 )

42 2A \052 *

43 2B \053 +

44 2C \054 ,

45 2D \055 -

46 2E \056 .

47 2F \057 /

48 30 \060 0

49 31 \061 1

50 32 \062 2

51 33 \063 3

52 34 \064 4

53 35 \065 5

54 36 \066 6

55 37 \067 7

56 38 \070 8

57 39 \071 9

58 3A \072 :

59 3B \073 ;

60 3C \074 <

61 3D \075 =

62 3E \076 >

63 3F \077 ?

64 40 \100 @

65 41 \101 A

66 42 \102 B

67 43 \103 C

68 44 \104 D

69 45 \105 E

70 46 \106 F

71 47 \107 G

72 48 \110 H

73 49 \111 I

74 4A \112 J

75 4B \113 K

76 4C \114 L

77 4D \115 M

78 4E \116 N

79 4F \117 O

80 50 \120 P

81 51 \121 Q

82 52 \122 R

83 53 \123 S

84 54 \124 T

85 55 \125 U

86 56 \126 V

87 57 \127 W

88 58 \130 X

89 59 \131 Y

90 5A \132 Z

91 5B \133 [

92 5C \134 \

93 5D \135 ]

94 5E \136 ^

95 5F \137 _

96 60 \140 `

97 61 \141 a

98 62 \142 b

99 63 \143 c

100 64 \144 d

101 65 \145 e

102 66 \146 f

103 67 \147 g

104 68 \150 h

105 69 \151 i

106 6A \152 j

107 6B \153 k

108 6C \154 l

109 6D \155 m

110 6E \156 n

111 6F \157 o

112 70 \160 p

113 71 \161 q

114 72 \162 r

115 73 \163 s

116 74 \164 t

117 75 \165 u

118 76 \166 v

119 77 \167 w

120 78 \170 x

121 79 \171 y

122 7A \172 z

123 7B \173 {

124 7C \174 |

125 7D \175 }

126 7E \176 ~

127 7F \177 DEL delete

128 80 \200 ¥

129 81 \201 ª

130 82 \202 â

131 83 \203 Ä

132 84 \204 ã

133 85 \205 É

134 86 \206

135 87 \207 à

136 88 \210 ö

137 89 \211 ä

138 8A \212 É

139 8B \213 Ü

140 8C \214 Î

141 8D \215 Ù

142 8E \216 Ú

143 8F \217 ¶

144 90 \220 Æ

145 91 \221 Ô

146 92 \222 Õ

147 93 \223 Ò

148 94 \224 Ó

149 95 \225 ¥

150 96 \226 Ð

151 97 \227 Ñ

152 98 \230 ÷

153 99 \231 ª

154 9A \232 û

155 9B \233 Ý

156 9C \234 Ï

157 9D \235 ÿ

158 9E \236 õ

159 9F \237 Ù

160 A0 \240 Ê

161 A1 \241 Á

162 A2 \242 ¢

163 A3 \243 £

164 A4 \244 Û

165 A5 \245 ´

166 A6 \246 |

167 A7 \247 ¤

168 A8 \250 ¬

169 A9 \251 ©

170 AA \252 »

171 AB \253 Ç

172 AC \254 Â

173 AD \255 Ð

174 AE \256 ¨

175 AF \257 ø

176 B0 \260 ¡

177 B1 \261 ±

178 B2 \262 2

179 B3 \263 3

180 B4 \264 «

181 B5 \265 µ

182 B6 \266 ¦

183 B7 \267 á

184 B8 \270 ü

185 B9 \271 1

186 BA \272 ¼

187 BB \273 È

188 BC \274 ¹

189 BD \275 ¸

190 BE \276 ²

191 BF \277 À

192 C0 \300 Ë

193 C1 \301 ç

194 C2 \302 å

195 C3 \303 Ì

196 C4 \304 �

197 C5 \305 �

198 C6 \306 ®

199 C7 \307 �

200 C8 \310 é

201 C9 \311 �

202 CA \312 æ

203 CB \313 è

204 CC \314 í

205 CD \315 ê

206 CE \316 ë

207 CF \317 ì

208 D0 \320 Ü

209 D1 \321 �

210 D2 \322 ñ

211 D3 \323 î

212 D4 \324 ï

213 D5 \325 Í

214 D6 \326 �

215 D7 \327 x

216 D8 \330 ¯

217 D9 \331 ô

218 DA \332 ò

219 DB \333 ó

220 DC \334 �

221 DD \335

222 DE \336 Þ

223 DF \337 §

224 E0 \340 �

225 E1 \341 �

226 E2 \342 �

227 E3 \343 �

228 E4 \344 �

229 E5 \345 �

230 E6 \346 ¾

231 E7 \347 �

232 E8 \350 �

233 E9 \351 �

234 EA \352 �

235 EB \353 �

236 EC \354 �

237 ED \355 �

238 EE \356 �

239 EF \357 �

240 F0 \360 Ý

241 F1 \361 �

242 F2 \362 �

243 F3 \363 �

244 F4 \364 ™

245 F5 \365 �

246 F6 \366 �

247 F7 \367 Ö

248 F8 \370 ¿

249 F9 \371 �

250 FA \372 �

251 FB \373 �

252 FC \374 �

253 FD \375 à

254 FE \376 ß

255 FF \377 Ø


Compressing

archive = the archive to make from

original = the file or folder to compress

tar -czf archive original = tar and GZip

zip -mR9yT archive original = zip (Windows)


Decompressing

archive = the archive to decompress

tar -xzf archive

unzip -tX archive


pine - Shell prompt

pine = start pine and go to the main menu

pine addr = start pine with a blank message to addr, and quit when it's sent/canceled

pine - Main menu

c = create new outgoing message

l = folder list

a = address book

pine - Lists

- = backward (up) one screen

space = forward (down) one screen

d = mark item for deletion

u = unmark item for deletion

r = reply to it

f = forward it to someone else

< = previous list or menu

return or enter or > = view it

tab = select next new message

c = compose new message

pine - Lists - Entry markings

N = new; hasn't been read

(nothing) = has been read

A = has been read and/or replied to (i.e. answered)

pine - Incoming messages

- = bwd one screen

spc = fwd one screen

v = view attachment list

pine - Outgoing messages

ctrl-x = send message

ctrl-c = cancel and dispose of message (w/o sending)

ctrl-j = attach file(s)

ctrl-y = bwd one screen

ctrl-v = fwd one screen

ctrl-k = cut to end of line (same as emacs ctrl-k)

ctrl-u = uncut (same as emacs ctrl-y)


vi - Shell prompt

vi = start vi with an empty buffer and no open files

vi file = open file for editing

vi - Command mode

i = input mode

esc = command mode

:se number = display line numbers

:se nonumber = don't display line numbers

:e = open file

:w = save (write) file to disk

:wq = save and quit

:q! = quit but don't save

number,command = apply command number times (e.g. 4,x = delete 4 characters)

. = repeat last effective cmd

esc,u = undo it

vi - Command mode - Moving the cursor

- = go to beginning of previous line

0 (zero) or ^ = go to beginning of this line

$ = go to end of this line

ret or + = go to beginning of next line (NOT THE SAME AS INPUT RETURN)

w = go to beginning of next word

b = go to beginning of this word

e = go to end of this word

sft-h = go to first line onscreen

sft-l = go to last line onscreen

ctrl-f = forward (down) one screen

ctrl-b = backward (up) one screen

1,sft-g = top of the buffer

sft-g = bottom of the buffer (i.e. EOF)

line,sft-g = go to line (e.g. 3,5,sft-g = line 35)

column,| = go to column (e.g. 4,| = column 4)

vi - Command mode - Deletion

deleted text is put to the general purpose buffer; use the p cmd to retrieve it

you can also use yanks to not delete it but still put it in the GPB

basically delete = cut and yank = copy in your OS's Edit menu

x = delete this character

d,w = delete word

d,d = delete line

sft-d = delete to end of line (same as emacs ctrl-k)

y,w = yank to beginning of next word

sft-y or y,$ = yank to end of line

y,y = yank entire line

buffer"lines"y,y = yank lines number of lines into buffer buffer (a-z)

p = paste contents of general-purpose buffer

vi - Command mode - Replacement

to use replacers type the sequence and then type the string of characters to replace with, e.g. 2,c,w,"Bored Zo" to replace from the cursor to the end of the next word to "Bored Zo"

r = replace a single character

shift-r = replace characters from the cursor(e.g. if | is the cursor and your text is "I AM the |Entertained Zo!" shift-r,"Bored" will give you "I AM the Boredtained Zo!")

c,w or c,e = change from cursor to end of word

c,b = change from beginning of word to before cursor

c,$ or sft-c = change from cursor to end of line

c,c = change the ENTIRE line

:x,ys/oldstring/newstring/ = substitute newstring for oldstring from line x to line y (if y = $ then to EOF)

~ = toggle a character's case

vi - Command mode - Searching

see section on regular expressions above

/ = search forward from cursor for a pattern

? = search backward from cursor for a pattern

n = next result

sft-n = previous result

vi - Command mode - Insertion

o = insert a blank line below this one

sft-o = ...above this one

:r file = insert file at cursor


emacs

note that you can use alt- instead of esc, and each binding will still work.

e.g. alt-esc,esc = cancel (like ctrl-g), alt-x = summon command prompt

emacs - Shell prompt

emacs = start emacs with one empty buffer and no open files

emacs file = open file for editing

emacs file +number = open file and scroll to line number

ctrl-x,ctrl-c = quit

emacs - Buffers

ctrl-x,ctrl-f = open file and create a buffer for it

ctrl-x,b = switch buffers (default is the next)

ctrl-x,k = kill (close) buffer and file

ctrl-x,0 (zero) = kill window

ctrl-x,1 = kill other window(s)

ctrl-x,2 = spawn new window under this one

ctrl-x,3 = spawn new window to the right of this one

ctrl-x,o (oh) = switch to other window

emacs - Text mangling

emacs - Text mangling - Moving the cursor

arrows = move cursor 1 character in any of the 4 cardinal directions - horizontal position in the line is maintained when you move u/d

esc,f = fwd (right) one word

esc,b = bwd (left) one word

ctrl-a = move to start of line

ctrl-e = end of line

esc,r = move to window line (?!)

ctrl-v = fwd (down) one screen (typically 22-24 lines)

esc,v = bwd (up) one screen

ctrl-x,] = fwd one page (defined by lpd?)

ctrl-x,[ = bwd one page

esc,< = top of buffer

esc,> = bottom of buffer

emacs - Text mangling - Moving strings

ctrl-t = transpose this character and the previous

esc,t = transpose this word and the next or previous depending on position in word

ctrl-x,ctrl-t = transpose this line and the previous

esc,c = properly capitalizes the word (Like this)

esc,l = decapitalizes the entire word (like this)

esc,u = capitalizes the entire word (LIKE THIS)

ctrl-spc = set mark

ctrl-w = cut selection (text from mark to cursor) to kill buffer (clipboard)

esc,w = copy selection

ctrl-y = paste ("yank") contents of kill buffer to working buffer

emacs - Text mangling - Search and replace

ctrl-s = search fwd (down) from cursor

ctrl-r = search bwd (up) from cursor

esc,ctrl-s = search fwd from cursor using a regular expression (see above)

esc,ctrl-r = search bwd from cursor using a regexp

esc,sft-ctrl-5 = replace fwd from cursor using a regexp

ctrl-g = cancel

! = replace all from cursor and including this hit

? = help

. = go back to where search started and exit replace

y/spc = replace and continue

n = don't replace but continue

emacs - Text mangling - Deletion

anything you delete is put to the kill buffer - up to kill-buffer-max (def. 30) can be in the kill buffer at any one time

ctrl-y = yank last (most recent) item in kill buffer

esc,y = substitute just-yanked text for next-to-last item in kill buffer

ctrl-d = delete this character (same as fwd-del)

del = delete previous character

esc,d = delete next word

ctrl-w = wipe (kill) selection and put it to kill buffer (see above)

ctrl-k = kill everything from cursor to end of line (eol)

emacs - Email

emacs - Email - rmail

esc,x,rmail = start rmail mode/check email

emacs -f rmail = ...from the shell

h = list your email

p = read previous message

n = read next message

sft-, = read first message

sft-. = read last message

number,j = jump to numberth message

emacs - Email - rmail - Reading

. = top of message

spc = fwd one screen

bksp = bwd one screen

 

emacs - Email - rmail - Deleting

d = flag this message for deletion

u = unflag it

x = delete all flagged messages

ctrl-o,filename = save this message to filename (ASCII text)

emacs - Email - sendmail

ctrl-x,m = new message

ctrl-x,4,m = ...in another window

ctrl-c,ctrl-w = paste the .signature file here

ctrl-c,ctrl-c = send this(definition *) l->val;

if (def->def_kind == DEF_PROGRAM) {