Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Unix 14 questions

Posted on 2015-02-21
9
Medium Priority
?
101 Views
Last Modified: 2016-04-04
Dear Experts,

I attended an Unix Oracle interview last week and i managed to answer the questions with the help of knowledge which i have gained from you/EE.

But i would like to know various method of doing the same . So request you to spend some time and answer the queries below .

1.What is difference between softlink and hardlink?
2.What is file system in Unix?
3.What does #! (shebang) tells in the script ?
4.What is nohup?
5.How to pass a variable var1=TEST from parent script 1.sh to child script 2.sh?
6.How to find files which was modified in last 30 days?
7.How to find files which was not modified in last 30 days?
8.What is the difference between ONICE and ONHOLD in Autosys?
9.How to print the 50th line in a file?
10.Difference between grep and find?
11.Difference between du and df?
12.How to terminate a process in shell?
13.How to read/list a compressed file?
14.How to add a line "TEXT" in the 1st and last line of the file?


Thanks,
Magento
0
Comment
Question by:magento
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 40623667
Consulting the unix man pages is a good method.
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40624596
A basic Linux course will help you on the way.
0
 
LVL 5

Author Comment

by:magento
ID: 40624994
This is what i have tried.

1.What is difference between softlink and hardlink?
Softlink is kind of shortcut and its share the same inode whereas hardlink doesnt have same inode.
softlink: ln -s shortcut originalpath
hardlink: ln target original
2.What is file system in Unix?
/etc , /dev , /bin , /var/log etc are file systems in Unix.
3.What does #! (shebang) tells in the script ?
Which Shell the script going to use . eg./bin/bash or /bin/ksh
4.What is nohup?
If i use nohup script.sh , even when the terminal/session exits the script will run .
5.How to pass a variable var1=TEST from parent script 1.sh to child script 2.sh?
export var1=TEST;
source 2.sh
6.How to find files which was modified in last 30 days?
find . -mtime -30
7.How to find files which was not modified in last 30 days?
find . -mtime 30
8.What is the difference between ONICE and ONHOLD in Autosys?
ONHOLD - if we do OFFHOLD will run at the same occurence.
ONICE - If we do OFFICE will run at the next occurence.
9.How to print the 50th line in a file?
sed '50' p filename ; cat -n filename | grep ^50 ; head -51 filename | tail -1 ;
10.Difference between grep and find?
Grep search using regex pattern .
11.Difference between du and df?
du -sh gives disk usage and df -h gives disk space
12.How to terminate a process in shell?
kill PID ; kill -9 PID ;
13.How to read/list a compressed file?
tar -tvf file.tar
14.How to add a line "TEXT" in the 1st and last line of the file?
echo "TEXT" >> filename ; echo "TEXT" newfile ; cat filename >> newfile ; mv newfile filename

Thanks
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 40625008
2: ext2->ext4, zfs,jfs,xfs, ReiserFS,BTRfs,CRFS  

Each has its own advantages and disadvantages http://bit.ly/1JAY3mX

nohup command line-utility which allows to run command/process or shell script that can continue running in the background after you log out from a shell
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 40625282
1. A symbolic link is a file on its own, containing a pointer to another file.
Hard links are just inodes pointing to a file/directory. Several inodes can point to the same file.
2. A filesystem is a structure used to manage (store/retrieve/control)
files, directories and other entities, such as hard/soft links.
3. The shebang tells the calling shell which interpreter (shell) to use
for running the called script.
4. nohup disconnets the called process from the associated tty.
In combination with "&" (backgrounding) the process will survive
the termination of the calling process ("logout" if it's your login shell) even if
there is activity on stdout/stdin/stderr. nohup automaticall redirects
stdout/stderr to a file ~/nohup.out.
5. "export var1=TEST" or "var1=TEST; export var1"
No "sourcing" required from parent to child.
6. find . -type f -mtime -30
7. find . -type f ! -mtime -30 or find . -type f -mtime +30
8. -----
9. sed -n "50p" filename
10. grep inspects the content of files, find inspects the filesystem.
11. "du" reports on the inode level,thus the user running "du" must have
write access to all files and directories,and open files in memory are not seen.  
"df" reports on the filesystem (superblock) level, thus the space occupied
by open files is included.
12. Terminate a foreground process running in your current shell
with <Ctrl><C> which sends an interrupt signal to that process.
Terminate other processes with "kill".
13. A tar archive is not compressed by default, you must specify the "z" flag to compress/uncompress.
tar -ztvf <compressed_archive> to list, tar -zxvf <compressed_archive> to uncompress and exctract.
Use "zcat" or "zmore"/"zless" to view compressed flat files.
14. sed -i.bak -e '1iTEST' -e '$aTEST' filename
 

Note: Question #8 ("Autosys") is beyond my experience.
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40626799
Taking the risk that this comment will be deleted by someone and because I did not recognize AutoSys as well, I searched and found this: http://javarevisited.blogspot.nl/2013/08/difference-between-on-hold-and-on-ice-jobs-autosys-interview-question.html?m=1
0
 
LVL 5

Author Comment

by:magento
ID: 40648480
Hi Experts,

I will close this question by weekend. Thanks
0

Featured Post

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question