RSS
 

Posts Tagged ‘bash command’

Using Linux Shell to Add a User

12 Jan

Hiya all. As I continued to work with my remote server’s shell, a new issue arose. I needed to add a new user to my system.

So, suppose that you want to add Mr. Friend to your system via bash:

useradd mrfriend

Okay, now you need to set a password for our friend:

passwd mrfriend

You will be prompted to enter the password and confirm it.

However, to do all this you need to be root. To do so, before entering any of these, type:

su -

Don’t forget the “-“, because otherwise you will get a “command not found” when you issue “useradd”.

Note: On some systems the command is “adduser” instead of “useradd”.

 

Kill users in Linux shell

08 Jan

Okay, first off, this is not a tutorial to show you how to kill your nemesis. For that, you need to take shooting lessons (or maybe, learn how to mix poisons).

Killing here means logging out a user. This can be particularly useful if somebody has logged into your PC whom you don’t want to have access. Or whom you simply don’t like.

For instance, if you are managing a server, and a particular user is eating up all the bandwidth and also won’t listen to reason, you can just log him out. Simple as that.

There’s a good set of utilities called “procps” which might come handy. It contains a tool called “skill” which helps you send signals and such to users and other active (or inactive) processes.

Okay, enough talk. Let’s send some cool signals.

The syntax of the skill command looks like this:

skill -SIGNAL -u USERNAME

There are a possible number of signals you can send. And obviously, you will be sending those signals to the user with username “USERNAME”.

Signals to send to users

You can send these different signals to users:

  • stop; which means you want that user’s activities to be halted. It’s like pushing the “Pause” button on a video set.
  • cont; is the resume button, whereas “stop” was the pause. You can use “cont” to allow the user to continue with his/her activities.
  • kill; now, this sounds like something the Dark Lord would have loved. You send the “kill” signal, the user’s session ends.

Example: Logging out “mr-enemy”

Okay, suppose your enemy – with the convenient user name “mr-enemy” – has logged into your system, and you want to log him out, just to spite him.

Here’s what you do:

skill -kill -u mr-enemy


Easy, no? You can also halt his session to irk him some more:

skill -stop -u mr-enemy

More Information

One thing to note, is that to stop a user you have to be “root”. More information on the skill command can be found by typing into your shell:

man skill

There, you will (probably) see that it is a deprecated command. However, I myself couldn’t find a replacement.

Other useful commands from the procps package include: top, kill, w, free, and vmstat.

Tired of your life?

No problem, you can even commit suicide with Linux shell:

skillkill –u [yourusername]

where [yourusername] is replaced with your user name (surprise!).

Note: NEVER kill the “root” if you don’t want to cold reboot your system!

 

GNOME Shell: A Sneak Peak

05 Nov

Hi all. This is my last post – hopefully – with my Toshiba Satellite, which is a borrowed laptop. I’ll be getting back my own Vaio-Z laptop tomorrow after about 90 days, and already my fingers are itching to touch its smooth and easy keyboard.

Anyways, as I am going to give this laptop back tomorrow morning, I installed the new Ubuntu release, Karmic Koala on it. It runs very satisfyingly. Of course, I’ve not had the time to really test things in it, but almost everything works out of the box, and the boot time is a real boost. I was skimming through GNOME live, as is my habit, when I saw the article title GNOME Shell. Now, I searched a bit here and there, and found out that it is actually supposed to replace the original GNOME desktop by GNOME 3.0.

To test it under your Ubuntu, you have to install it:

sudo apt-get install gnome-shell

Then, you have to run it as a replacement for the original GNOME desktop:

gnome-shell --replace

After that, you will see something like this:

GNOME Shell in action

As you can see, there is now only one panel available, and it’s placed on the top of the screen. There are two main hot spots on the panel:

  1. On the left side you can see the “Activities” button,
  2. On the right side you can see the user menu.

Hovering over (or clicking on) the “Activities” button/area will bring up the Overlay view, a full-screen view which will give you some interesting new ways of interacting with your PC. It looks something like this:

GNOME Shell's overview area

On the left side, you have a flat sidebar featuring a search box, an applications’ pane, a places area, and a recently opened files list. On the applications pane, you can use the “More” button to see something like the old Applications menu in the traditional GNOME desktop. On the right side, you can see the “Overview” area which gives you an overview of all your workspaces and all the applications running on them.

All in all, it has a rather neat design and shows promise of a more innovative desktop. However, it is still ways from what Jeremy has proposed. Also, I think the whole top panel is a waste, as it is. I have seen it being put to very good use by the netbook-launcher application which uses it as the common area for the maximized windows’ title bars. Also, with GNOME shell we cannot switch between open windows without the keyboard and without going to the Overlay perspective, which can be amended by placing the icon’s of these application in the top panel.

This shell also features a sidebar, which is very much a work in progress. In fact, I think of it more as a draft of something which might become available in a future not so near.

All said, I like it. It is creative, it is simple, and man, it is cool! And I’ll definitely be looking forward to working with it when GNOME 3.0 is released.

 
No Comments

Posted in Review