File permissions?

Johnny Rosenberg gurus.knugum at gmail.com
Sat Dec 26 09:02:24 UTC 2009


2009/12/25 Jim Byrnes <jf_byrnes at comcast.net>:
> Johnny Rosenberg wrote:
>> 2009/12/25 Jim Byrnes <jf_byrnes at comcast.net>:
>>> I've been using Ubuntu for about two weeks now and am starting to get
>>> used to it.  However, coming from an OS/2\Windows world file permissions
>>> seem to be giving me some grief.
>>>
>>> Maybe if someone could tell me how to do a couple of specific tasks it
>>> would become clearer to me.  I have Jedit loaded on all three of my
>>> OS's. I have modified some mode files on the other OS's I would like to
>>> use on Ubuntu.  I copied them to a shared folder on Ubuntu but I can't
>>> copy them to /usr/share/jedit/modes which is where Jedit will look for them.
>>
>> Is there a special reason why the files have to be located there? For
>> most tasks, your personal files should be located somewhere in your
>> home directory (home folder), called $HOME, which is an environment
>> variable containing the address of your home folder. The ”~” means the
>> same thing. So ~/MyFolder is the same thing as $HOME/MyFolder, which
>> is the same thing as /home/Jim/MyFolder if your user name is Jim.
>> If you still want to place your file at /usr/share/jedit/modes you
>> have to do it with root permissions, unless you want to change the
>> owner of the folder.
>
> They were put there by the installaion of Jedit.  They are really not
> personal files.  They control syntax highlighting depending upon the
> type of file you are editing.  I just modified a couple of them to suit
> my taste.

Oh… in that case I would just edit them by opening them in my
favourite editor as root in the terminal, for instance:

gksudo gedit /usr/share/jedit/modes/FileName

Since you say you are a beginner, I will also mention the convenient
use of the ↹ key (TAB) (hopefully this message will not be ”converted”
with another character encoding than UTF-8, otherwise you can't see my
TAB characters and it will look somewhat confusing…). To input the
line above, you will probably only need to do this:

gk↹s↹ ge↹ /u↹sh↹je↹m↹/Fi↹↵

↹ expands what you typed so far. If there are several possibilities to
expand, you can hit ↹ twice to see the options.

 You can copy, cut and paste in the terminal, but the default
shortcuts are Shift+Ctrl+x, Shift+Ctrl+c and Shift+Ctrl+v rather than
just Ctrl+x, Ctrl+c and Ctrl+v. Of course you can change this if you
want to: Edit → Keyboard shortcuts.

And you can use ↑ and ↓ if you want to walk through the commands
history. ↑ taking you one command backwards and ↓ is the other way, of
course.

Oh, and another thing: The & operator puts the process in the
background, for example:

gedit MyFile&

This will open gedit with MyFile and the terminal isn't locked to it
while I am editing MyFile, so I can use it for other things at the
same time, not needing to open another terminal. The terminal first
outputs the process ID for you, in case you want to kill the process:
kill 23596
(if the process number was 23596).

Well, what's more? A lot, of course… it's also convenient to know
about the <, > and >> operators.

free -m > MyFile
This redirects the output of the free -m command to the file MyFile.
If the file exists it will be erased, created and filled with the data
from the command. If it doesn't exist it will be created and filled
with the data.

free -m >> MyFile
Data from free -m will be added at the end of MyFile.

The < goes the other way around: It use a file for sending data to the command.

To look at your textfile the ultra simple way, try this:
cat MyFile

If the file is big, one of these will be more convenient:
more MyFile
less MyFile

I prefer ”more”, but most people prefer ”less” I think, You decide
what you prefer. Both commands views the file page by page. To see the
next page, hit SPACE. Or ↵ I think.
Try this simple way to create a text file:

cat > MyTextFile
Hello world!
Hello people!
Ctrl+d

cat MyTextFile

To erase files, use the rm command (ReMove):
rm MyTextFile
rm MyFile

If you want to know more about a command, like rm for instance, do:
man rm

If you are not sure what command to use when, let's say you want to
remove a file, try:
man -k remove
(-k as in ”keyword”)

To quit the man command, just hit q to get back to your prompt.
alias is also a useful command. Maybe you think it's too much typing
to hit ”ls -lB --si” everytime you want to view the contents of a
directory. This will make it easier:
alias ll='ls -lB --si'
>From now on, just type ”ll” for doing the same thing.
When you log out and login again, your aliases will be forgotten, so
you need to put all your aliases in a file that is run at every
startup. ~/.bashrc is a good one. Personally I created my own alias
file, ~/.bash-aliases, which I start from the ~/.bashrc file by just
adding the following lines in ~/.bashrc:

if [ -f ~/.bash-aliases ]; then
    . ~/.bash-aliases
fi

The alias file will then be started only if it exists.
There are a few aliases pre defined. I moved mine to the alias file.

To see all your aliases, try:
alias

To remove an alias:
unalias

And we also have the beloved | character (pipe character).

Try this, for instance:
ps -e

Now try this:
ps -e | grep gnome

The last command only shows lines that contains the string ”gnome”.
See man ps and man grep for more details.

Well, that's all for now, I guess… I guess it would be better to point
to a link or something, so I'll do that too:
http://www.gnu.org/software/bash/manual/bashref.pdf


Johnny Rosenberg

>
>>
>> You can do most things with a GUI and since other people have
>> suggested doing it in the terminal, I will try to keep more to a GUI.
>> If you don't have an icon for opening Nautilus (your file manager)
>> with root permissions, open a terminal (!) and enter:
>> gksudo nautilus
>> (sudo nautilus will also do, but then you need to enter your password
>> in the terminal instead of doing it in a dialogue…)
>> Now look for your files and move them where you want them.
>> When they are where you want them, right click them and click
>> Properties, then click the permissions tab. Here you can change the
>> owner of the file as well as the permissions. After changing the owner
>> to yourself and given yourself the proper permissions, you should be
>> able to do what you want with them with jedit.
>>
>> If you don't have a icon for ”Nautilus as root”, you can easily create
>> one. Ask if you can't figure out how.
>>
>> Johnny Rosenberg
>>
>
> Thanks for the info on the gui way to do it.  Sometimes the terminal can
> be a little overwhelming to a newbie.
>
> Regards,  Jim
>
>>> In that same vein, if I wanted to edit one of those files with Jedit how
>>> could I get Jedit to open it for editing?
>>>
>>> Thanks,  Jim
>>>
>>> --
>>> ubuntu-users mailing list
>>> ubuntu-users at lists.ubuntu.com
>>> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>>>
>>
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>




More information about the ubuntu-users mailing list