maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   X Term capability? (https://talk.maemo.org/showthread.php?t=47905)

zwer 2010-03-21 22:52

Re: X Term capability?
 
Quote:

Originally Posted by roja (Post 576301)
thanks guys, i wonder for all these actions above, do you have to be root to be able to execute these commands/scripts??? if yes, then what can a user do(any tweaks?) in X Term without Root???

You can do everything that is in the user space ( /home/user ) - modifying files, executing applications that have +x for your group/nobody system-wise, and such. Here is a nice article that explains permissions.

Quote:

Originally Posted by roja (Post 576397)
also is there a log which records all the commands you put in X Term?

Yes, it's called .ash_history, you can find it at /home/user/.ash_history (for the user, or /root/.ash_history for the root user), and you usually access it in shell using up/down cursor keys. You can list it with: cat ~/.ash_history

roja 2010-03-21 23:04

Re: X Term capability?
 
thanks zwer, for the log i mean all commands, which means "all" commands you have used, not only for the current session.

zwer 2010-03-21 23:36

Re: X Term capability?
 
It's not only for the current session - it will remember last 15 commands IIRC, if you do a clean xterm exit (by typing exit). There are several bugs / feature requests filled in Bugzilla considering xterm functionality to allow extending the number of remembered commands (to at least 100-200) as well as to catch xterm window close to do a clean exit and write down the history. Those should be fixed by now, haven't really checked their statuses lately.

roja 2010-03-21 23:51

Re: X Term capability?
 
thanks zwer

roja 2010-03-22 00:06

Re: X Term capability?
 
two more questions:
1, is it possible for this: execute commands(long ones), make X Term to remember these commands, and when need these commands again, X Term can execute these commands automatically without need to type these commands again???

2, without root, user can't play with the OS settings, but still can play with user settings, in this case, if user mess up with user settings, N900 will not work properly, and user only need to reflash eMMC image???

roja 2010-03-22 00:13

Re: X Term capability?
 
as a new user to Linux, am trying to learn about command lines in X Term, someone on the forum has already suggested books/websites to read, however I can't help to wonder without Root, what kind of damage a new linux user can cause with X Term on N900?? and which commands should be used with extra care???

many thanks

zwer 2010-03-22 00:18

Re: X Term capability?
 
Quote:

Originally Posted by roja (Post 576489)
1, is it possible for this: execute commands(long ones), make X Term to remember these commands, and when need these commands again, X Term can execute these commands automatically without need to type these commands again???

As I've said earlier - it will remember any typed command in the history, provided it doesn't get overwritten by newer commands. If you really want to keep some commands to recall them at any time, write them in a form of a shell script, e.g.:

Code:

#/bin/sh
<your command here>

And then just chmod +x it.

Quote:

Originally Posted by roja (Post 576489)
2, without root, user can't play with the OS settings, but still can play with user settings, in this case, if user mess up with user settings, N900 will not work properly, and user only need to reflash eMMC image???

You can hardly mess up the system that much as a user to require reflashing - usually deletion of a specific messed up setting would fix everything after a reboot. But yes, eMMC reflash will be all you need to get back on the track.

Quote:

Originally Posted by roja (Post 576495)
I can't help to wonder without Root, what kind of damage a new linux user can cause with X Term on N900?? and which commands should be used with extra care???

Just don't delete and/or modify the files you don't know what they do (and if you want to, first google about them to see what exactly can you expect), especially outside of the /home/user directory, and you'll be fine. You'd actually need a good deal of knowledge to mess up the system that badly not to be able to recover it. Even with rm -rf /* (human readable translation: delete EVERYTHING) as a root user, you'd be able to recover the system with reflashing.

geneven 2010-03-22 00:35

Re: X Term capability?
 
The basics for what you can do with xterm are the same for all Linux systems, and you can google something like help xterm and find more than enough reading on the subject to last forever.

roja 2010-03-22 00:37

Re: X Term capability?
 
zwer, thanks very very much for your help. When you say "You can hardly mess up the system that much as a user to require reflashing - usually deletion of a specific messed up setting would fix everything after a reboot."

does it mean "reboot" will help to restore something back to default??
and how does a n00b like myself knows "damm, this is messed up, and it will need to be reflash with eMMC or FW image"??? I justgot so nervous, everytime i open X Term and execute a basic command like ls, will think "did i mess anything up? do i need to reflash eMMC or FW??" please enlight me with your professional knowledge

is there a such thing like one command line accidentally send private info to someone on the contact list?

again, thanks for your patient with a n00b like me.

zwer 2010-03-22 01:11

Re: X Term capability?
 
That behavior is typical for true multi-user systems - system-wide settings are kept outside of user space, and only user specific settings are kept in it, thus separating the system and the users - if some user messes up his settings, the system and other users will not suffer.

It is because of that behavior that applications first load with their default, system-wide settings, and then (if they are user-configurable) they check for the local, user-space settings of the current user, and if there isn't any they usually create default user-space configuration files. If you type: ls -a /home/user/ in xterm you'll see that there are actually quite a lot of `hidden` directories created by those applications which hold user-specific settings. So, if you mess up, and then delete your local settings, upon restart of the named application (some might require reboot or are harder to restart than to reboot the device all-together) - the user settings will be recreated. For example, you can `reset` your browser (MicroB) back to the default settings by deleting /home/user/.mozilla/microb directory (rm -rf ~/.mozilla/microb) - it will delete all your bookmarks, saved passwords, settings and so, but once you restart your device (or restart browserd & microb) the folder and all the needed settings will be recreated.

However, be aware that some applications execute with super user privileges and that they store their settings on a system-wide area - you won't be able to edit their settings by hand unless you switch to superuser mode (that's what sudo does). One of them would be Application Manager - it needs to run as a super user as it is installing applications outside of the user space. If you change some settings for such applications, you risk potentially bricking the device after which you'll have to reflash it.

As for how will you know if you've messed up - well, something will not work as it used to work, or will not work at all. As I said, before attempting to change or delete something, try to Google it first to get the idea what are you doing. If you mess up outside of the user area, and in such way that it's irrecoverable by reverting the settings back to what they were (i.e. your N900 enters in a constant reboot loop) - you'll have to reflash it. Messing up in the user area is usually more forgiving (given the nature of the device, it is not as forgiving as on regular desktop Linux as the N900 logs in as the predefined user `user` automatically) and in most cases if you can get to the xterm and/or log in via SSH, you'll probably be able to fix it by either reverting back the modified file, or deleting it and letting the system rebuild it.

There is probably a very long, even `cryptic` command that would be able to send something (private) to one of your contacts, but you'll hardly be able to type that by mistake so I wouldn't be worried about that.


All times are GMT. The time now is 18:57.

vBulletin® Version 3.8.8