03072014 Flashcards
Run a command and save the output in a file
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
Internal return code generated
echo $?
# a return of zero means success # a non zero means error
pipe (|) operator:
Display only the lines from route that contain the phrase eth0
route | grep eth0
Build and execute command lines from standard input
And then sample locating a file and provide long list
xargs
locate file1.txt | xargs ls -la
Print lines matching a pattern
grep, egrep, fgrep
SENDING OUTPUT FROM ONE TERMINAL TO ANOTHER
- Open two terminals
- in one terminal run tty
- in the other terminal run route command
- route > /dev/pts/1
the output will go to that terminal
Print the file name of the terminal connected to standard input.
tty
USING THE SCREEN PROGRAM
Screen is a full screen window manager that shares a physical terminal with other processess
- screen -L
- Ctrl +A the press C
- Ctrl + A + 0
- Ctrl + A + 3