Useful Linux (Ubuntu) Tidbits |
|
Here are just some morsels of information about the Linux Command line, and more specifically, Ubuntu Linux Command line / system.
Users can be added to a group with the command:
sudo adduser <username> <groupname>
In ubuntu, the default system shell is "Dash". That does speed up your system boot, but it also introduces problems with those scripts which are designed to run in bash, but use /bin/sh to execute. (Which is a surprising amount... this has solved many problems for me. Especially with Asterisk and freePBX.)
To set Ubuntu back to using bash from dash, run the following command...
cd /bin && sudo rm sh && sudo ln -s /bin/bash /bin/sh
Add a user underneath the "# User privalage specification" comment. If you want just a bog standard sudo user, able to do all on the system, add the line:sudo visudo
?Fun? tip: add "insults" to the end of the list of "Defaults" in visudo, so it will look like:<username> ALL=(ALL) ALL
The system will insult you every time you enter your sudo password wrongly. For a random example, it just gave me this when I deliberately triggered it:Defaults !lecture,tty_tickets,!fqdn,insults
You speak an infinite deal of nothing
Type "pwd" to get the full path to your current directory. e.g.:
kirrus@asus:~$ pwd
/home/kirrus
Monit is a useful program, that gives you a good way of keeping an eye on your servers, making sure they don't run out of harddisk space, or get a high CPU load. It can either perform some function (like stopping a program from running) during high CPU, or send you a warning email.
http://debianhelp.co.uk/monit.htm (useful howto/basic guide)
http://www.tildeslash.com/monit/ (main website)
Monit is in the ubuntu repositories:
aptitude install monit
...
Regarding the Storm worm, I do plan a follow up. But I'm just at the basic "read lots" stage...
I'll second the Monit suggestion. We implemented it last month to manage our Mongrel clusters and the difference has been night and day with regards to recovering from memory leaks and instituting rolling restarts of the cluster while doing deploys. Next on the list is to examine the best way we can use it to monitor the MySQL cluster we are building... :-D
Another usefull tip which should work in *nix systems is if you screw up and make it crash, wait - don't go presing the reset button!
Hold down Alt+Print Screen and type REISUB . It Kills all processes unmounts the drives nicely etc.
Elwood: Aye, Monit is useful... alerts us to problems caused by using Gambas unstable to write code... Only tricky bit is, we get alerts every night, as the box does some intensive mysql database cleanups (deletes lots of fields, and optimises tables) nightly.
Might have solved that one... we'll see tomorrow, if I get any more false-alarms..
Hi Gazzat :D
Crashes, if you have crashed your GUI, you can get into a command line, by hitting CTRL-ALT-<FUNCTION KEY> . Generally, function keys F1-F6. F7 (at least, in Ubuntu) is the GUI.
Also, if you can't recover from that, CTRL-ALT-BACKSPACE will restart your X server, which should kill everything GUI wise, and reload the login page..