Bash Cmds Flashcards
1
Q
Cd
A
Change directory
2
Q
.. or .
A
Parent directory
Current directory
3
Q
~
A
Home directory
4
Q
Vi
A
Text editor
5
Q
Ls
A
List
6
Q
Ls user
A
Lists directories
7
Q
Pwd
A
Print working directory
8
Q
Ls-s
A
Reference to a file
9
Q
Chmod
A
Give permissions
10
Q
Less[file]
A
Show one page at a time
11
Q
Touch file
A
Create a file
12
Q
Ls -l file
A
Gives info about file
13
Q
Echo
A
Display a line of txt/str on stdr or file
14
Q
Rm
A
Remove
15
Q
Type
A
Determine if cmd built in, an alias, or executable
16
Q
Cat[file 1,file 2]
A
Copy files to stdout as listed
17
Q
Date
A
Displays date and time
18
Q
Wc[file]
A
Word count (#lines, words, chars)
19
Q
Clear
A
Clears screen
20
Q
help[cmd]
A
Display description of shell cmd
21
Q
< > »_space; >& <>
A
- stdin
- stdout
- append
- stdout/stderr
- stdout/stdin
22
Q
*
A
All
23
Q
?
A
any 1 character
24
Q
[abc]
A
Any char in set
25
[!abc]
Any char not in set
26
$
Variables
27
Cp
Copy
28
History
500 lines of history
29
History n
Most recent n cmds
30
History -c
Delete history
31
!!
Repeat last cmd
32
!n
Repeat cmd n
33
! -n
Repeat cmd n cmds ago
34
!foo
Repeat cmd started with foo
35
Env
Display environment variables
36
“=“
Set bar
37
$PATH
Displays list directory
38
Export
Export shell variables
39
- e
- fi
- d
- w
- o
- switch that determines if file at a particular path
- end of an if block
- True if file is reg file
- true if file exists and is writable
- true if your the user
40
Make vars ints
Have to use casting
| (y=y+1)
41
Or / and
&& ||
42
-lt
Less than
43
mkdir
```
Make directory (creates a new folder)
Ex) mkdir ~/Desktop/seng265
```
44
mv
Moves file from one place to another
| ex) mv
45
Vim [filename]
Opens file in txt editor (creates new file if non specified
Command mode: issue cmds
Insert mode: type text
46
Set
Displays environment and shell variables