03072014 Flashcards

0
Q

Run a command and save the output in a file

A

the redirection (>) operator is used instead of sending the output to the screen

e.g.

ifconfig > file1.txt
cat file1.txt
sort < file1txt
sort output-file.txt

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

Internal return code generated

A

echo $?

# a return of zero means success
# a non zero means error
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

pipe (|) operator:

Display only the lines from route that contain the phrase eth0

A

route | grep eth0

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

Build and execute command lines from standard input

And then sample locating a file and provide long list

A

xargs

locate file1.txt | xargs ls -la

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

Print lines matching a pattern

A

grep, egrep, fgrep

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

SENDING OUTPUT FROM ONE TERMINAL TO ANOTHER

A
  1. Open two terminals
  2. in one terminal run tty
  3. in the other terminal run route command
  4. route > /dev/pts/1
    the output will go to that terminal
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Print the file name of the terminal connected to standard input.

A

tty

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

USING THE SCREEN PROGRAM

Screen is a full screen window manager that shares a physical terminal with other processess

A
  1. screen -L
  2. Ctrl +A the press C
  3. Ctrl + A + 0
  4. Ctrl + A + 3
How well did you know this?
1
Not at all
2
3
4
5
Perfectly