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 |
Quote:
|
When you have no idea about what you're searching, even google doesn't help you.
|
Quote:
|
Look, if you don't want to help, then don't. I'm sure there are some non-judgmental people on this forum.
|
A little quotation, from the LQ rules:
Quote:
|
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. |
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 |
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" |
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. |
#7:
Control Z puts it in the background, typing fg puts in the foreground! |
When in doubt, Charlie out.
That means guess the C answer if you have no idea. (I should control myself but sometimes) |
8) sed '/^\#/d' .bash_rc > .bash_rc.new
|
Alican, I thought I was the world's worst student, but I have to say you are very serious competition!
Quote:
Try them yourself! Quote:
cd .. goes to the directory above the present working directory. So if I'm not mistaken: Quote:
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. |
Count how many users are not using bash as a login shell
Code:
awk -F ":" '!/bash/ { print $7 }' /etc/passwd | wc -l For number 9 you need to read man ln |
All times are GMT -5. The time now is 03:02 PM. |