LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help for a newbie? (https://www.linuxquestions.org/questions/linux-newbie-8/help-for-a-newbie-920191/)

kiwizzle 12-23-2011 08:16 AM

Help for a newbie?
 
Hello there.

I got a few probably easy questions, though I can't seem to make it work ;p

in ubuntu, how do I create a file in, lets say "/tmp/scripts", that contains a list of all filenames in the directory /bin that end wih s or t?

also how do I change permisson of a file to, lets say, r-xrwx---?

I'm fairly new to Linux and just looking around for basic knowledge that could proove usefull.

regards. Kiwizle

sycamorex 12-23-2011 08:23 AM

Hi

Code:

ls /bin | egrep "*.[ts]" > /tmp/scripts/file

When it comes to permissions, have a look at this tutorial:
http://www.comptechdoc.org/os/linux/..._ugfilesp.html

jhw 12-23-2011 08:30 AM

Quote:

Originally Posted by kiwizzle (Post 4556937)
in ubuntu, how do I create a file in, lets say "/tmp/scripts", that contains a list of all filenames in the directory /bin that end wih s or t?

One way to do this would be a combination of 'ls' and 'grep':

Code:

ls /bin/ | grep s$ >> /tmp/scripts && ls /bin/ | grep t$ >> /tmp/scripts
Quote:

Originally Posted by kiwizzle (Post 4556937)
also how do I change permisson of a file to, lets say, r-xrwx---?

You can use 'chmod' for this. Best would be to read the manpage, but for your example it would be:
Code:

chmod 570 $filename

kiwizzle 12-23-2011 08:43 AM

Thanks for the advice :)

sycamorex 12-23-2011 08:54 AM

Glad to be of help.
If you think that your problem has been solved, please mark the thread as read (in the thread tools)

kiwizzle 12-23-2011 09:06 AM

Also, is there any command to see which filesystems are installed?

jhw 12-23-2011 09:11 AM

If you just want to know, which filesystems are currently mounted, use the 'mount' command.

kiwizzle 12-23-2011 09:20 AM

allright, but lets say I want create an alias that will display the last 5 mounted filesystems, any advice?


just trying to make things tricky for myself to learn some ;P

silent 12-23-2011 09:26 AM

I think 'mount' lists them from 1st to last
Just do
Code:

mount | tail -n 5

kiwizzle 12-23-2011 09:38 AM

Thanks for the help, lads


All times are GMT -5. The time now is 10:19 AM.