Posted on 30-09-2009
Filed Under (linux, ubuntu) by admin

To see which processes are currently on a system, most people use the “ps” and “top” commands. The “ps” command gives you a snapshot (in a single list) of processes running at the moment. The “top” command offers a screen oriented, constantly updated listing of running commands, sorted as you choose ( by CPU, memory, UID, etc).

ps #List processes of current user at current shell

root@ubuntu-box:~# ps
  PID TTY          TIME CMD
 2988 pts/0    00:00:00 su
 2996 pts/0    00:00:00 bash
 3047 pts/0    00:00:00 ps

ps -u jorge #Show all jorge’s running processes

root@ubuntu-box:~# ps -u jorge
  PID TTY          TIME CMD
 2662 ?        00:00:00 x-session-manag
 2725 ?        00:00:00 VBoxClient
 2730 ?        00:00:00 VBoxClient
 2737 ?        00:00:00 VBoxClient
 2748 ?        00:00:00 ssh-agent

ps -u jorge u #Show all running processes with CPU/MEM Read the rest of this entry »

Comments Off    Read More   
Posted on 26-09-2009
Filed Under (linux, ubuntu) by admin

Running out of disk space can be annoying on your desktop system and potentially a disaster on your servers. To determine how much disk space is available and how much is currently in use, you can use the “df” command. To check how much space particular files and directories are consuming, use the “du” command.
The “df” command provides the “-h” options which output in a human-readable, usually in MB or GB.
This command display space on file systems in human-readable form

[root@Fedora11-vbox ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_fedora11vbox-lv_root
                      6.7G  3.6G  2.9G  56% /
/dev/sda1             194M   21M  163M  12% /boot
tmpfs                 250M  292K  250M   1% /dev/shm

If you have remote share mounted, these will show up too. So to limit the output to local systems only:

df -hl

To check for disk space usage for particular files or directories in a file system:

[root@Fedora11-vbox ~]# du -h /home/
4.0K	/home/smbuser/.mozilla/plugins
4.0K	/home/smbuser/.mozilla/extensions
12K	/home/smbuser/.mozilla
4.0K	/home/smbuser/.gnome2

If you have root priviliges, you can use the “-s” option to get a summary of disk usage; otherwise, you will get “permission denied” when trying to access directories that you don’t have access to. Read the rest of this entry »

(2) Comments    Read More   
Posted on 26-09-2009
Filed Under (linux, networking, ubuntu) by admin

Understanding subnetwork mask can be confusing if you’re not used to them. You may find “ipcalc” (from ipcalc package) useful to calculate a computer network’s mask.

First start by installing “ipcalc” from the repositories, depending on your distro:

sudo apt-get install ipcalc #for debian distros like ubuntu
yum install ipcalc #for fedora

then find the ip address for which you want to calculate the network for, and enter it along with “ipcalc” command

[root@Fedora11-vbox ~]# ipcalc -bmn 192.168.10.122/22
NETMASK=255.255.252.0
BROADCAST=192.168.11.255
NETWORK=192.168.8.0

So in this scenario, the subnetmask is (255.255.252.0), the broadcast address (192.168.11.255), which means that the last usable ip address for that network is (192.168.11.254), and last the network address (192.168.8.0); therefore, the first ip address for that range will be (192.168.8.1).

Comments Off    Read More   
Posted on 25-09-2009
Filed Under (linux, security, ubuntu) by admin

After you have created users accounts, and let those users loose on your somputer, there are different commands you can use to keep track of how they are using your computer. There are commands for checking such things as who is logged into your system and getting general information about the users with accounts on your system. Here are some of these commands.
last #list the most recent successful logins

root@ubuntu-box:~# last -a
smbuser  pts/2        Fri Sep 25 06:37   still logged in    windows-box
jorge    pts/1        Fri Sep 25 06:35   still logged in    windows-box
jorge    pts/1        Fri Sep 25 06:34 - 06:35  (00:00)     windows-box
 
wtmp begins Fri Sep 25 06:34:52 2009

lastb #List the most recent unsuccessful logins

root@ubuntu-vbox:~# lastb
smbuser  ssh:notty    windows-box      Fri Sep 25 05:36 - 05:36  (00:00)
jorge    :0                            Fri Sep 18 17:28 - 17:28  (00:00)
jorge    :0                            Fri Sep 18 17:28 - 17:28  (00:00)
jorge    :0                            Fri Sep 18 17:27 - 17:27  (00:00)
jorge    :0                            Fri Sep 18 17:27 - 17:27  (00:00)
jorge    :0                            Fri Sep 18 17:27 - 17:27  (00:00)

who -u #List who is currently logged in (long form) Read the rest of this entry »

Comments Off    Read More   
Posted on 20-08-2009
Filed Under (linux, networking, security, ubuntu, windows) by admin

VNC is considered to be an insecure protocol. The password is sent using fairly weak encryption, and the rest of the session is not encrypted at all. For that reason, when using VNC over an untrusted network or internet, I recommend you tunnel it over SSH.

To forward VNC port 5900 on localhost to remote host port 5900

ssh -L 5900:localhost:5900 vncserver

If your ssh server is listening on other port like: 222

ssh -L 5900:localhost:5900 vncserver -p 222

The same procedure can be done on a window$ machine using putty Read the rest of this entry »

Comments Off    Read More   
Posted on 19-08-2009
Filed Under (linux, ubuntu) by admin

tar is a compression utility that allows you to compress files and backup up your system.
Here are some useful tar commands to backup and restore files.
if you want to backup the content of /home and /etc:

tar cvpf /mnt/backup/tarball_bakup /home /etc

Once you have a full backup of your system you could do incremental backups using the –newer option, which backs up everything that has changed since the specified date

tar cvpf /mnt/backup/tarball_backup --newer 19Aug09 /home /etc

when things go wrong and you want to restore the content of backup

tar xvpf /mnt/backup/tarball_backup home/user

Sometimes you accidentally deleted a file; therefore, you only need to restore a single file. Remember when restoring from a tar archive, there’s no absolute path, in other words, tar removes all the leading slash “/” so /home/user/file1 becomes home/user/file1. And you should be in the / “root” directory.

tar xvpf /mnt/backup/tarball_backup home/user/shell1.sh

What about if you don’t know the exact name of the file but only part of the file name

tar tvpf /mnt/backup/tarball_backup | grep shell*

or

tar tvpf /mnt/backup/tarball_backup | more

to page trhough the backup file.

Here’s a good shell script  that performs monthly, weekly, and daily backus to a tgz file. Read the rest of this entry »

Comments Off    Read More   
Posted on 19-12-2008
Filed Under (linux, ubuntu) by admin

Recently I had to install ubuntu on a machine with a bad cdrom drive, which made me look for alternative ways of installing ubuntu. This article describes two ways of how to install Ubuntu by copying the content of the installation CD to an USB drive such as a memory stick (or flash drive) and making the USB stick bootable. This is handy for machines like ultra portable notebooks that do not have a CD drive but can boot from USB media. On a side note, I have to point out that booting from USB stick can be very handy, but there is no guarantee that it will work with your particular combination of computer and USB stick. Even if you are able to boot from your USB stick on one computer, this does not mean that it is going to work with the next one. You can try experimenting with different settings in your PC’s BIOS to make it work.
Read the rest of this entry »

(2) Comments    Read More