- The following command displays output only on the screen (
stdout ).
$ ls
The following command writes the output only to the file and not to the screen.
$
The following command (with the help of tee command) writes the output both to the screen (
$
http://linux.101hacks.com/unix/tee-command-examples
- Syntax To redirect all error to file
command-name 2> errors.txt
syntax to redirect both output (
Syntax to redirect errors (
Data written to a null or zero special file
command1 2> /dev/null
command1 2> /dev/zero
http://www.cyberciti.biz/faq/linux-redirect-error-output-to-file/
- /dev/null
On Unix/Linux system there is a special
For example, you might have an application, one that you cannot change, that spit tons of messages to the standard error channel. If you don't want to see that on the screen you can redirect it to a file. But if you do that, it can fill your disk quickly. So instead, you would redirect the standard error to /dev/null and the operating system will help you disregard all the "garbage".
http://perlmaven.com/stdout-stderr-and-redirection
Every process in Linux is provided with three open files( usually called file descriptor). These files are the standard input, output and error files. By default:
Standard Input is the keyboard, abstracted as a file to make it easier to write shell scripts.
Standard Output is the shell window or the terminal from which the script runs, abstracted as a file
Standard error is the same as standard
A file descriptor is
http://www.linuxtechi.com/standard-input-output-error-in-linux
- BASH Shell: How To Redirect
stderr Tostdout ( redirectstderr to a File)
Bash and other modern shell provides
[a]
[b]
[c]
Understanding
The Unix / Linux standard
Handle Name Description
0
1
2
The following will redirect program error message to a file called error.log:
$ program-name 2> error.log
http://www.cyberciti.biz/faq/redirecting-stderr-to-stdout
- 25 Linux Shell Scripting interview Questions & Answers
What is Shell Script and why it
Ans: A Shell Script is a text file that contains one or more commands. As a system administrator we often need to issue
Q:2 What is the default login shell and how to change default login shell for a specific user
#
#
Q:4 How to redirect both standard output and standard error to the same location
Ans:
Method:1 2>&1 (#
Method:2 &> (#
http://www.linuxtechi.com/linux-shell-scripting-interview-questions-answers/
- What is the system command to find the current environment variables of the shell you’re running?
The command is “
What is swapping and
Consider a reference book, for example. You only open the page you need- you
Paging is more efficient if UNIX is running
https://blog.udemy.com/unix-shell-scripting-interview-questions/
Specify the difference between absolute path and related path?
Absolute path refers to the exact path as defined from the root directory. Related path refers to the path related to the current locations.
What is the FIFO?
FIFO (First In First Out)
What is mean by Super User?
The user with access to all files and commands within the system
What is the process group?
A collection of one or more processes
What are the different file types available
Regular files
Directory files
Character special files
Block special files
FIFO
Symbolic links
Socket
https://www.softwaretestinghelp.com/unix-interview-questions/
- The
mkfifo commandbasically lets you create FIFOs (a. k. a named pipes)
You'd have seen commands that contain a vertical bar (|) in them. This bar
ls | grep .txt
The command mentioned above
Both these programs
So what pipe does here is, it creates a channel of communication between these programs
when the aforementioned command
So finally, the output that gets displayed on the terminal
mkfifo pipe2
So 'pipe2' is now a named pipe. Now comes the question how named pipes are more useful? Well, consider the case where you have a process running in a terminal and producing output, and what you want is to channelize that output on to a different terminal. So here, a named pipe
https://www.howtoforge.com/linux-mkfifo-command/
Some of the frequently used shells in UNIX includethe following :
zsh
sh
csh
ksh
bash
https://www.onlineinterviewquestions.com/unix-interview-questions/
- Explain the difference between soft and hard links?
The most common difference between the soft and hard link is, a hard link is a direct reference to the file in UNIX. However
Can you link directories to soft links?
Yes, you can link directories to the soft links as the file system structure supports them.
How do you know if you have the soft or hard link?
The soft link commonly known as the symbolic is the original copy of the file while the hard link is the perfect replica of the original file. So, if you delete the original copy from the system then the soft link won’t have any value but the case is right opposite in
What hard links do
Do hard and soft link shares the same
Yes, both hard link and soft link share the same
Do hard link work even after deleting the soft link?
Yes, the hard will work even after you end up deleting the soft file. As they are a perfect mirror copy of soft link, you can access the file until the links to the file are
Can you link directories to hard links?
https://www.gangboard.com/blog/unix-shell-scripting-interview-questions-and-answers/
- Discuss the difference between swapping and paging?
Swapping
It the procedure of copying the entire process from main memory onto secondary memory.
For execution,
Paging
What
Unix operating system
Explain Superblock in UNIX?
https://www.softwaretestinghelp.com/unix-interview-questions/
No comments:
Post a Comment