Topic 2: Finding Your Way on a Linux System

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

1/101

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.

102 Terms

1
New cards

shell

a program that enables text-based communications between OS and user

2
New cards

Bourne-again shell

another name for the Bash shell

3
New cards

Bash Shell

also known as the Bourne Again Shell, this is the default command line interface in Linux.

4
New cards

csh or tcsh (enhanced)

The C-shell (csh) uses syntax similar to the syntax used in the C programming language.

5
New cards

ksh

The Korn Shell (ksh) was designed to take the best features of the Bourne shell and the C shell and extend them. It has a small but dedicated following among Linux users.

6
New cards

zsh

The Z shell (zsh) takes shell evolution further than the Korn Shell, incorporating features from earlier shells and adding still more.

7
New cards

username@hostname current_directory shell_type

The prompt for an interactive shell

8
New cards

~

When in a prompt, it represents the current user's home directory

9
New cards

$

shell_type meaning regular user

10
New cards

#

shell_type meaning root superuser

11
New cards

command line structure

command [option(s)/parameter(s)...] [argument(s)...]

12
New cards

internal command

A command that is a part of the shell and does not exist as a file on disk. There are about 30 of them. E.g. cd, set, export, ls

13
New cards

external command

a command that is in an individual file as a binary program or script. When run, the shell uses the PATH variable to search for an executable file with the same name as the command. Can be created by user

14
New cards

type

command which shows what type a command is.

$ type echo

echo is a shell builtin

$ type man

man is usr/bin/man

15
New cards

quoting

a feature which encapsulates data. "data", 'data', or escape characters are valid. Usually used for special characters or spaces. Each one acts differently

16
New cards

"data"

Double quotes take the data and treat it as regular characters. Most special characters lose meaning (all except $, \`). Variables, command substitution, and arithmetic functions can be used

$ echo I am $USER

I am tom

$ echo "I am $USER"

I am tom

$ touch new file

$ ls (simplified)

new

file

$ touch "new file"

new file

17
New cards

'data'

Single quotes treat ALL characters as regular characters, no exceptions

$ echo I am $USER

I am tom

$ echo 'I am $USER'

I am $USER

18
New cards

\

escape characters. These remove special meaning from individual characters.

$ echo $USER

carol

$ echo \$USER

$USER

19
New cards

echo

output text on terminal

20
New cards

ls

list the contents of a directory

21
New cards

touch

creates an empty file, or updates an existing file's modification date

22
New cards

hostname

change or show a system's hostname

23
New cards

local variables

variables available to current shell process only

24
New cards

environment variables

variables available both in this session and in its sub processes. Most are in capital letters (PATH, DATE, USER). Default variables are usually this type.

Can be accessed using $variable_name or at the front of a command e.g. ($: TZ=EST date)

25
New cards

$ variable_name=value

creates a local variable

26
New cards

accessing variables

putting a $ in front of variable's name access it's value

$ greeting=hello

$ echo greeting

greeting

$ echo $greeting

hello

27
New cards

unset variable_name

removes a variable

28
New cards

export

turns a local variable into an environment variable. Can be done with or after making a local variable.

$ export greeting=hey

IS THE SAME AS

$ greeting=hey

$ export greeting

29
New cards

PATH

variable holds a list of directories that contain executable programs. new directories can be appended by using a colon

30
New cards

$ PATH=$PATH:new_directory

appends new directory to the PATH variable

31
New cards

$ which command_name

finds where the given command is found

32
New cards

$ env

displays the current environment

33
New cards

/usr/share/doc/

Directory containing additional documentation files, such as readme files and support for third-party software.

34
New cards

$ man command_name

command that provides a manual ("man") page. It displays the command's documentation

35
New cards

--help

an option that, when run with a command, displays brief instructions about the usage of the command

36
New cards

Q

to exit the man page, press this key

37
New cards

man sections

There are 11:

1 NAME

2 SYNOPSIS

3 DESCRIPTIONS

4 OPTIONS

5 ARGUMENTS

6 FILES

7 EXAMPLES

8 SEE ALSO

9 DIAGNOSTICS

10 COPYRIGHT

11 BUGS

38
New cards

NAME

Command name and brief description

39
New cards

SYNOPSIS

Description of the command's syntax

40
New cards

Description

Description of the effects of the command

41
New cards

Options

Available options for the command

42
New cards

Arguments

Available arguments for the command

43
New cards

Files

Auxiliary files of the command

44
New cards

EXAMPLES

a sample of the command line with the command

45
New cards

SEE ALSO

Cross-references of the command

46
New cards

DIAGNOSTICS

warning and Error messages and what they mean

47
New cards

COPYRIGHT

Author(s) of the command

48
New cards

BUGS

any known limitations or bugs of the command

49
New cards

less

a command that displays content in a somewhat interactive format. search with /linux (forwards of cursor) or ?linux (backwards of cursor). Type N to jump to next match. press H for a menu.

50
New cards

$ info command_name

similar to man, but more detailed. hypertext formatting. Navigation is available, and links. ? opens the menu

51
New cards

$ locate string

outputs every name that matches the given string. Supports wildcards and regular expressions.

52
New cards

updatedb

a command that updates the database. Can be run if recent files aren't showing up in locate search

53
New cards

find path_to_search -name name_to_check

instead of maintaining and searching a database, find recursively searches a directory tree. Also supports RegEx and wildcards. Options allow filtering of output

54
New cards

cat

concatenates or views text files

55
New cards

cut

removes sections from a text file

56
New cards

cd

changes directory

57
New cards

cp

copies a file

58
New cards

mv

moves or renames a file

59
New cards

mkdir

makes a new directory

60
New cards

wc

counts the number of words, lines, or bytes in a file

61
New cards

passwd

changes a user's password

62
New cards

rm

deletes a file

63
New cards

rmdir

deletes a directory. Must be empty, unless -r in which case it deletes recursively

64
New cards

more

views text files one screen at a time

65
New cards

whereis

Displays the file path to a specified program and related manual files

66
New cards

head

displays the first few lines of a file

67
New cards

tail

displays the last few lines of a file

68
New cards

sort

orders a file numerically or alphabetically

69
New cards

tr

translates or removes characters of a file

70
New cards

chmod

changes a file's permissions

71
New cards

grep

searches within a file

72
New cards

pwd

print working directory (prints current location)

73
New cards

ls -a

reveals hidden files and directories

74
New cards

..

parent directory

75
New cards

.

current location

76
New cards

tree

display the hierarchical listing of a directory tree

77
New cards

root filesystem

the very very base of the filesystem. anything not found in /home/user is part of this

78
New cards

home directory

Users' "HOME" directory is usually /home/USERNAME

Not Universal

your home directory can be abbreviated using a tilde: ~

79
New cards

$ su - user_name

switch user to user_name. You will be prompted to input a password

80
New cards

cd ~

return to the user's home directory. Can also be done by using cd without arguments

81
New cards

~username

this specifies the home directory of username, as opposed to your own home directory. Requires permissions

82
New cards

ls -l

the '-l' option creates a long list

83
New cards

ls -lh

Long listing with Human readable file sizes

84
New cards

ls -d

lists directories but not contents. ls -d */ shows only subdirectories and no files

85
New cards

ls -t

list sorted by modification time

86
New cards

ls -lrt

r reverses, so this is a long list with oldest modifications first

87
New cards

ls -lX

Combines long list with the option to sort by file eXtension. This will, for example, group all files ending with .txt together, all files ending with .jpg together, and so on.

88
New cards

ls -S

sorts by file size

89
New cards

ls -R

displays a recursive list--includes the contents of all subdirectories

90
New cards

ll

an alias that gives ls -l. Long list

91
New cards

mkdir -p

the parent option allows creation of nested directories

92
New cards

$ echo hello > hello.txt

creates a hello.txt file containing "hello"

93
New cards

>

writes output of command to a file instead of the terminal

94
New cards

mv -i

this checks if you want to overwrite an existing file if the new name you're renaming a file to already exists

95
New cards

rm -ri

remove empty directories, prompt you before removing nonempty directories

96
New cards

cp -r

allows copy to work on directories

97
New cards

globbing

a simple pattern matching language, like regular expressions but simpler

98
New cards

*

matches any number of any characters, including none

99
New cards

?

matches any one character

100
New cards

[class]

matches characters in the brackets