LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-18-2010, 03:10 PM   #1
Alican
LQ Newbie
 
Registered: May 2010
Location: Hungary
Distribution: Ubuntu
Posts: 9

Rep: Reputation: 0
Help needed with my OS exam tomorrow.


Edit: Could you guys verify the answers I come up with?

Here are the questions, thanks in advance.
1- Count how many users are logged in currently. One user counts only once.
2- Count how many users are not using bash as a login shell
3- List all of the users whose login names contain “all” in them.
4- List all the symbolic links’ names in the current directory.
5- Count how many users are celebrating his name day at 6th of December (Santa Claus in Hungarian is Miklos)
6- Remove all files named “Core” and “core” from your home directory.
7- Start the archiving process of your home directory. Suspend the process and put it into the background. How can you get it back to the foreground?
8- Remove the comment from the .bash_rc file and create a new version as .bash_rc.new
9- How can you create a symbolic link?
10- List the content of the actual directory using ctime as sorting key and show only the first four entries.

1) users | wc -l
2) cat /etc/passwd | grep -v \/bin\/bash | wc -l
3) cat /etc/passwd | cut -d ":" -f1 | grep all
4) ls --file-type | grep @ OR find . -xtype l
5) cat /etc/passwd | cut -d ":" -f1 | grep Miklos (I'm not sure)
6) cd ~ && rm [cC]ore OR find ~ -type f | grep -e "[C|c]ore"
7) cd
cd ..
tar -cf homearchive.tar home
ctrl+Z
fg
8) sed '/^\#/d' .bash_rc > .bash_rc.new
9) 9) ln -s [src_file] [link_name]
10) ls -al --sort=time | head -n5 | tail -n4

Last edited by Alican; 05-18-2010 at 06:45 PM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-18-2010, 03:21 PM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
Google didn't help me very much.
Why don't I believe this?
 
Old 05-18-2010, 03:23 PM   #3
Alican
LQ Newbie
 
Registered: May 2010
Location: Hungary
Distribution: Ubuntu
Posts: 9

Original Poster
Rep: Reputation: 0
When you have no idea about what you're searching, even google doesn't help you.
 
Old 05-18-2010, 03:44 PM   #4
brucehinrichs
Member
 
Registered: Mar 2008
Location: US
Distribution: Debian Sid; Sabayon, UbuntuStudio, Slackware-multilib 13.1, Peppermint Ice, CentOS
Posts: 575

Rep: Reputation: 67
Quote:
When you have no idea about what you're searching, even google doesn't help you.
If you are truly this clueless, you should fail.
 
Old 05-18-2010, 03:47 PM   #5
Alican
LQ Newbie
 
Registered: May 2010
Location: Hungary
Distribution: Ubuntu
Posts: 9

Original Poster
Rep: Reputation: 0
Look, if you don't want to help, then don't. I'm sure there are some non-judgmental people on this forum.
 
Old 05-18-2010, 03:52 PM   #6
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

Rep: Reputation: Disabled
A little quotation, from the LQ rules:
Quote:
Do not expect LQ members to do your homework - you will learn much more by doing it yourself.
 
Old 05-18-2010, 03:55 PM   #7
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
The answer to your first question can be found by following this link. I simply plugged your question into Google and then read up on the answer. Test the answers on your Linux box.

You *do* know the questions to ask, they are the exact questions you asked us.
 
Old 05-18-2010, 04:14 PM   #8
Alican
LQ Newbie
 
Registered: May 2010
Location: Hungary
Distribution: Ubuntu
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks! I've found these so far.
1) users | wc -l
3) users | grep all
4) ls --file-type | grep @
6) cd ~ && rm [cC]ore .
9) ln -s [src_file] [link_name]
10) ls -al --sort=time | head -n5 | tail -n4
 
Old 05-18-2010, 04:35 PM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Alican;

Normally, this would have been closed by now. Since you obviously just did some work, we'll keep going.

As XavierP said, you now need to test these commands on your system to see how they work. Also, look at the man page for each one---eg "man users"
 
Old 05-18-2010, 04:35 PM   #10
Alican
LQ Newbie
 
Registered: May 2010
Location: Hungary
Distribution: Ubuntu
Posts: 9

Original Poster
Rep: Reputation: 0
OK, maybe I'm going with the wrong approach here. Can you guys verify the answers I come up with at least?

7) cd (this should go to home directory if no path is given right?)
cd ..
tar -cf homearchive.tar home

edit: I have Ubuntu running on Virtual PC 2007 but number 2 and 3 didn't work for me or maybe they did but returned nothing.

Last edited by Alican; 05-18-2010 at 04:39 PM.
 
Old 05-18-2010, 04:37 PM   #11
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,330

Rep: Reputation: 227Reputation: 227Reputation: 227
#7:
Control Z puts it in the background, typing fg puts in the foreground!
 
1 members found this post helpful.
Old 05-18-2010, 04:44 PM   #12
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,381

Rep: Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382Reputation: 2382
When in doubt, Charlie out.

That means guess the C answer if you have no idea.

(I should control myself but sometimes)
 
Old 05-18-2010, 05:09 PM   #13
Alican
LQ Newbie
 
Registered: May 2010
Location: Hungary
Distribution: Ubuntu
Posts: 9

Original Poster
Rep: Reputation: 0
8) sed '/^\#/d' .bash_rc > .bash_rc.new
 
Old 05-18-2010, 05:20 PM   #14
impert
Member
 
Registered: Feb 2009
Posts: 282

Rep: Reputation: 54
Alican, I thought I was the world's worst student, but I have to say you are very serious competition!
Quote:
Can you guys verify the answers I come up with at least
?
Try them yourself!

Quote:
7) cd (this should go to home directory if no path is given right?)
cd ..
tar -cf homearchive.tar home
cd (on my machine) goes to MY home directory: ie /home/<myusername> NOT /home
cd .. goes to the directory above the present working directory. So if I'm not mistaken:

Quote:
cd
cd ..
tar -cf homearchive.tar home
will only make an archive if you have a directory /home/home, otherwise it will spit out an error message.
But don't take my word for it, I'm at least the world's second worst student, try it out.

Good luck, and thanks for starting one of the funniest threads I've read in a long time.
 
Old 05-18-2010, 05:41 PM   #15
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
Count how many users are not using bash as a login shell
Code:
awk -F ":" '!/bash/ { print $7 }' /etc/passwd | wc -l
This page talks about the second part of number 7

For number 9 you need to read man ln

Last edited by Andrew Benton; 05-18-2010 at 05:54 PM. Reason: Added link about job control in bash
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LPIC 101 exam ceritifation practise dump needed latest salimshahzad Linux - Newbie 3 04-27-2010 11:13 AM
Study material and exam engine required for redhat RHS333 exam sandeep singh Linux - Certification 3 07-18-2009 09:10 AM
How to get the RHCE Exam, online exam or at college. hocheetiong Linux - Certification 2 08-20-2007 05:24 PM


All times are GMT -5. The time now is 05:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration