103.1 Work On The Command Line Flashcards

• Use single shell commands and one- line command sequences to perform basic tasks on the command line • Use and modify the shell environment including defining, referencing and exporting environment variables • Use and edit command history

1
Q

bash

A

is a command processor that typically runs in a text window where the user types commands that cause actions. Bash can also read and execute commands from a file, called a shell script.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

echo

A

echo command in linux is used to display line of text/string that are passed as an argument . This is a built in command that is mostly used in shell scripts and batch files to output status text to the screen or a file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

env

A

env is used to either print environment variables. It is also used to run a utility or command in a custom environment. In practice, env has another common use. It is often used by shell scripts to launch the correct interpreter. In this usage, the environment is typically not changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

export

A

export is bash shell BUILTINS commands, which means it is part of the shell. It marks an environment variables to be exported to child-processes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

pwd

A

print working directory - prints the directory file path you are working in.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

set

A

used to define and determine the values of the system environment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

unset

A

Unsetting or deleting a variable directs the shell to remove the variable from the list of variables that it tracks. Once you unset a variable, you cannot access the stored value in the variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

man

A

An interface to the on-line reference manuals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

uname

A

The uname Command. The uname command reports basic information about a computer’s software and hardware. When used without any options, uname reports the name, but not the version number, of the kernel (i.e., the core of the operating system).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

history

A

m, you can run the ‘history’ command by itself and it will simply print out the bash history of the current user to the screen. Commands are numbered, with older commands at the top and newer commands at the bottom. The history is stored in the ~/.bash_history file by default.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

.bash_history

A

f you want to access the actual file itself, just use your favorite text editor (I use emacs but you can use pluma of gedit or vimor whatever):

emacs ~/.bash_history

That is the default location if your history file. If you don’t find anything there, you may have changed the history file’s name. This is stored in the $HISTFILE variable, so print it out to check its current value:

echo $HISTFILE

Last 15 commands
You can use

history | tail -n 15

Searching for a command
Alternatively, use

history | grep “apt-get” | tail -n 15

How well did you know this?
1
Not at all
2
3
4
5
Perfectly