Question: 1.2 Job Control When working in the BASH environment, you can start multiple programs from the same prompt. For the purpose of the Lab, you

1.2 Job Control

When working in the BASH environment, you can start multiple programs from the same prompt. For the purpose of the Lab, you have to experiment with the following commands: nano & (for backgrounding a job); jobs (to see how many jobs BASH is tracking); fg and bg command.

1.3 Environment Variables

If you are familiar with the concept of environment variables in Windows, you will find that many of the things that you know about them will apply to Linux as well; the only difference is how they are set, viewed, and removed.

Printing Environment Variables: printenv

Setting Environment Variables: variable = value

Then use export to pass the value to other processes

Unsetting Environment Variables: unset variable

1.4 Pipes

Pipes are mechanism by which the output of one program can be sent as the input to another program. The vertical bar (|) character represents the pipe command. (ps fe | less)

1.5 Redirection

Through redirection (>), you can take the output of a program and have it automatically sent to a file.

Example: ls lsa > dump.txt

To append additional data to an existing file use two > symbols (>>).

1.6 Multiple Commands

Under BASH, multiple commands can be executed on the same line by separating the commands with semicolons (;). Since the shell is also a programming language, you can run command serially only if the first command succeeds. Try && command to experiment with two commands by switching their position.

1.7 Documentation Tools

man

info

1.8 Files Change Mode: chmod

Letter Permission Value

r Read 4

w Write 2

x Execute 1

The following list shows the most common combinations of the three permissions:

Letter Permission Value

--- No permission 0

r-- Read only 4

rw- Read and write 6

rwx Read, write, and execute 7

r-x Read and execute 5

--x Execute only 1

1.9 File Management

Copy Files: cp

Remote copy: scp (secure copy)

The syntax for scp is: scp

Note: Use of File Transfer Software like WinSCP, CyberDuck, FileZilla will maker the scp easier simply by drag and drop to/from remote/local machine.

Move Files: mv (moving a file from one directory to another or changing name of a file. Unlike copy (cp), move (mv) command removes the original file)

Link Files: ln

Find a File: find

Locate a File: locate

Concatenate Files: cat

Display a File One Screen at a Time: more

Disk Free: df; df -kh

Disk Utilization: du

Show the Directory Location of a File: which

Locate a Command: whereis

1.10 PROCESSES

List Processes: ps; ps fe; top

ps aux | sort nrk 3,3 | head n 5

Send a Signal to a Process: kill; kill -9

Show System Name: uname r;

uname rs (this command will let you know what is the OS Name and Kernel Version)

Who Is Logged In: who, logname

A Variation to who: w

1.11 Misc. Useful commands:

which sh

echo

sort r

wc; wc -l

su

uptime

diff

lsusb

lsmod

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!