Unix/Linux Command Line Basics: Shell, Files, and Navigation

0.0(0)
studied byStudied by 0 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/89

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

90 Terms

1
New cards

Echo command to find current shell?

echo $SHELL or echo $0

2
New cards

Command to append output to existing file?

>> (Example: ls >> file.txt)

3
New cards

Command that displays your username?

whoami

4
New cards

ls command to list all files including hidden?

ls -a

5
New cards

Pathname starting with slash is called?

Absolute pathname

6
New cards

True/False: Relative pathname begins with slash

FALSE

7
New cards

What does cd with no arguments do?

Changes to home directory

8
New cards

Unix file system structure type?

Hierarchical or tree-like

9
New cards

Default directory when you log in?

Home directory

10
New cards

Directory navigation - what is dot?

Current directory

11
New cards

Directory navigation - what is dot-dot?

Parent directory (up one level)

12
New cards

Command for help about other commands?

man (manual pages)

13
New cards

Hidden files start with what symbol?

Dot (.)

14
New cards

Echo command to display shell name?

echo $0

15
New cards

Valid syntax for man pipe to less?

man ls | less

16
New cards

How to display value of variable TOTAL?

echo $TOTAL

17
New cards

What does echo $PATH display?

Colon-separated list of executable directories

18
New cards

ls option to display permissions?

ls -l

19
New cards

Program not in search path result?

command not found error

20
New cards

Command to change file permissions?

chmod

21
New cards

Commands to change to home directory?

cd, cd ~, cd $HOME

22
New cards

Command to copy a file?

cp

23
New cards

Command for file type/classification?

file

24
New cards

Display text one screen at a time?

less or more

25
New cards

Find files by name in directory tree?

find

26
New cards

Link command syntax?

ln source_file link_name

27
New cards

Output text file contents?

cat

28
New cards

Search patterns in file?

grep

29
New cards

List files/subdirectories recursively?

ls -R

30
New cards

Create new directory?

mkdir

31
New cards

Rename or move file?

mv

32
New cards

Display logged-in users?

who or w

33
New cards

Remove non-empty directory?

rm -r directory_name

34
New cards

Delete a file?

rm

35
New cards

True/False: touch creates file if doesn't exist

TRUE

36
New cards

Script PID variable?

$$

37
New cards

All command-line arguments variable?

$* or $@

38
New cards

Number of arguments variable?

$#

39
New cards

Script name variable?

$0

40
New cards

Create shell variable syntax?

VARNAME="value" (no spaces)

41
New cards

Variable initialization syntax?

VARNAME="value" (no spaces around =)

42
New cards

Echo pipe to more does what?

Paginates output

43
New cards

Single vs double quotes difference?

Double allows variables, single literal

44
New cards

Read input command first method?

read variablename

45
New cards

Read input command?

read

46
New cards

$HOME contains?

Absolute pathname of home directory

47
New cards

find -name option purpose?

Search by filename

48
New cards

List only hidden files?

ls -d .*

49
New cards

Metacharacter for zero or more?

* (asterisk)

50
New cards

Metacharacter for exactly one?

? (question mark)

51
New cards

Pipe metacharacter?

| (vertical bar)

52
New cards

Exit Vim insert mode?

ESC

53
New cards

Enter Vim insert mode?

i, a, or o

54
New cards

Vim startup mode?

Native/Command Mode

55
New cards

Enter Vim command-line mode?

: (colon)

56
New cards

Vim save and quit?

:wq

57
New cards

Vim delete current line?

dd

58
New cards

True/False: Vim only opens existing files

FALSE

59
New cards

Display directory and hidden files?

ls -a

60
New cards

True/False: Symbolic links only to files

FALSE (directories too)

61
New cards

Owner execute in ls -l position?

Position 4

62
New cards

How to read ls -l output?

Positions 2-4 owner, 5-7 group, 8-10 others

63
New cards

Group name in ls -l?

Fourth field

64
New cards

Group permissions positions?

Positions 5-7

65
New cards

Others execute position?

Position 10

66
New cards

chmod 755 result?

rwxr-xr-x

67
New cards

Understanding chmod changes?

755=rwxr-xr-x, 644=rw-r--r--

68
New cards

True/False: User can chmod own files

TRUE

69
New cards

True/False: Only owner can view permissions

FALSE

70
New cards

True/False: Root can modify any permissions

TRUE

71
New cards

rmdir removes what?

Empty directories only

72
New cards

True/False: touch resets permissions

FALSE (updates timestamps)

73
New cards

Non-blank character sequence called?

Token or word

74
New cards

True/False: Bash options start with dash

TRUE

75
New cards

True/False: pwd has zero arguments

TRUE

76
New cards

True/False: echo is built-in

TRUE

77
New cards

Redirect ls -l to file?

ls -l > ls-out

78
New cards

Shebang line for bash?

#!/bin/bash

79
New cards

Run script in current directory?

./scriptname

80
New cards

Run function my_func?

Type: my_func

81
New cards

Alias command syntax?

alias name="command"

82
New cards

grep vs cat output?

grep shows matching lines, cat shows all

83
New cards

Startup configuration file?

.bashrc or .bash_profile

84
New cards

True/False: echo $HOME works (uppercase)?

TRUE (case-sensitive)

85
New cards

True/False: Symbolic links only to files (2nd Q)

FALSE

86
New cards

True/False: Only owner changes permissions

FALSE (root can too)

87
New cards

True/False: Script variables global by default

TRUE

88
New cards

Define function named test?

test() { commands; }

89
New cards

Functions persist between sessions?

FALSE

90
New cards

Export command purpose?

Makes variables available to sub-processes