Professional Documents
Culture Documents
Questions
3 How will you know who are the users logged in to the system before 15 minutes?
8 Which is the command used to find out currently executing Process in UNIX?
How to check whether some services are running in another server or not? Suppose i am
currently in a server named A.I want to check whether some services are running in server B
10 without logging into the server B.
13
14 A file has 1000 lines and i want to display only 1st line how to do it? pls ..tel me
15 How can i know my Filesystem and its current usage in my prod UNIX system?
what is the cmd to remove the comment lines from a file and to display the original text without
16 comments?
19 What is the different between UNIX command and UNIX shell script?
I have directories within the directory. Now i want to copy the directory along with all directories
20 included in it to one location by using copy command? what is the command
22 how will you login one server's shell prompt to an another server?
23 in a growing log file how will you see the 1st 99 lines?
how will you display a file whose name is starting with '- '? 2-how will you add a patten at end of
24 every line in vi editor?
26 use of ls command
28 write grep commands to select the lines that have exactly two characters
29 how to find the 51th record of a file containing 100 records in unix.
30 what is the difference between SED and GREP ? Which one is more better and why?
35 what is ls -ltd?
How to grep for a particular pattern in unix. I want to print the dates from the file exp.txt. the
36 date pattern is DD:MM:YYYY, I just want to print all the dates from the file exp.txt.
if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command
37 use in unix?
38
41 How can we "forked" process in UNIX? How then recognize in any of the branches we?
43
44 why unix operating system provides more security than other operating systems?
45
47
Assume the following files are in the working directory prompt> ls -l tasks
The rm command removes links to file. What does this mean? How then is a file deleted from
50 the file system?
When the shell is reading the command line what is the difference between text enclosed
51 between double quotes ( "" ) and text enclosed between signal quotes ( '' )?
Assume that a file.s permissions give you read and write access. What operations can you
perform on the file if it is in a directory which has .r.(read) only process? What operations can
52 you perform on the file if it is in a directory which has .x.(execute) only access?
59 Is there any command in Unix, other than:ls, to list the files in a directory?
60 How do you find which version and name of unix you are using at the command prompt?
What Is the command to change a file's creation time. means one file is created at the time
61 15:19 then time should br changed to 14:14
64 what will this do $cat > file.c ?(file.c is a file in current directory)
65 how unix kernel distinguishes between a normal file and device file ?
67 Give the command to display space usage on the UNIX file system.
70
how to remotely move a file ??? that mean how to move a file one machine to another machine
71 ???
73 what is mount ,tell me about mount ,how can u use in real time project??
75
78 How to setup sudo, only can use for particular date & time only ( for solaris10 )
79 Why we are using UNIX OS when we are doing the testing in our application?
What is FIND, GREP and SED ? Could you please give me the difference between all the
80 three? Where we use this commnands?
87 What is the difference between pipe (|) and tee command in unix
88 Write a command to find all of the files which have been accessed within the last 30 days.
89
90
91 How to get a particular string as your prompt ? Give syntax of that command?
92
96 What is the basic difference between unix and windows operating systems?
99 Through which command will redirect output to bOth screen and files at the same time?
Answers
echo /dev/null > file_name ( this will overwrite the file with null records)
sqlplus -S DB-username/DB-password@DB-NAME
There is no exact command to find it. Use "last -10" and check the timestamp
32
ps -ef
check the port number of that service using telnet command ( for eg. If you want to know about the ftp , u need to know the
default port of ftp (21) . The use this command to see if that service is running. "telnet <ip-of-serverB> 21
ps -aux or top
head -1 <file-name>
df -h .
grep ^# <file-name>
echo $?
cp -r <source-dir> <destination-directory>
ssh username-of-remote-server@remote-server-ip
ls -l |grep ^_
uname
KILL along is softkill. There is no guarentee the process will be killed. KILL -9 is termination.
find . -size 0
sed -e nd <file-name> ( this will delete "n" th line from the file. ( Remember "sed" will not modify the existing file. You will
need to redirect the output to a different file and rename that file to original file. Eg. Sed -e -20d file1 > file2 ; mv file2 file1
( First remove 20th line from file1 & redirect the output to file2. in the 2nd step rename file2 to file1)
tail -8 <file-name>
not sure is the answer. Because, there are morethan 1000 commands in unix. No one will ask such question. Even if they do
ur answer is "Many"
ptree <PID>
NO
any variable that is set in the current shell. The value of the variable can be referenced by using $VARIABLE_NAME
\ ( back slash)
-rw-rw-rw
If there is a link to a file, rm will delete the link only, it will not delete the original file. To remove the original file, you need to
execute rm <original-file>
double quotes ( "" ) group things together. Single quotes (' ') will bypass the shell interpretation.
unix was mainly developed by "C" creators. Linux is developed by Linus Torvald and largely by OpenSource community
ps -ef |grep <PID> , and check the parent proess id of PID. It should not be 0 ( or sometimes its listed as "defunct" process)
type <file-name> tells what kind of a file <file-name> is. Whether it’s a text file, binary file etc.
find . ( it will list everything in the current directory TREE, not just current direcotry)
uname -a ( gives all info about OS)
can not change the creation time. But access time (atime) , modified time ( mtime ) can be changed using "touch " command.
Touch -a -m -t<date-time-format>
a layer that provides a set of tools for the applications to interact with the hardware.
no difference
df -h
stream editor, this can search/replace an existing file lines and outputs the changed file. The original file is not modified
su
remove "Recursively & forefully" -- removes the contents of directory even if there are no write permissions ( only owner)
mount is a command to access a hard disk partions. A Mount point is a normal directory through which a file system can be
accessed.
mount -t ext4 /dev/sda1 /opt ( mounts /dev/sda1 raw file system on /opt directory)
a specfic part of the hard disk, formatted in correspondign OS ( ntfs for windows, ext4 for linux etc.)
there is no function of a zombie process. Zombies are orphan proceses whose parent processes are dead.
check above
update the file /etc/sudoers to specify which users can sudo and what commands they can run.
SED -- edit a file and store the output in a new file. Original file remains same.
just to hide a file. Hidden files are not shown in "ls" command output
touch updates the mtime of a file ( if file exists ) if not it will create a Zero Byte file with that name.
Cat will show the content of the file . ( for more options of "touch" "cat" check Durgasoft "Linux commands & Shell Scripting"
material.
cat > f1 ( creates a file f1 and opens it for writing) Or touch f1 , creates a zero byte file f1.
find /home/durgasoft -atime -30 ( checks all the files/directories under /home/durgasoft)
PS1="PARTICULAR STRING"
it’s the inbuild command to check the return value of a conditional expression. Eg. test 2 < 3 ( this will check , if 2 is less than
3 and returns true or false)
crontab -r
ps -u <user-name>
tee
redirect the input of previous command to the next command ( ls -l | tee f1)