Digital helpspace geekatorium arena

Kako preprečim, da Windows ne povozi GRUB na dual-boot sistemu


Windows will overwrite the boot sector whenever you install it, upgrade it to a new version, or use tools like bootrec /fixmbr, bootrec /fixboot, or the older fdisk /mbr. In general, install Windows first, then Linux. The boot sector will stay put until you do one of the things above. (And perhaps there are also other ways to write onto the MBR.) But, if you lose GRUB, it is easily restored:

  1. Boot from a live CD (CD/DVD or flash drive).
  2. Become root or use sudo with commands below.
  3. List the available partitions if needed: fdisk -l
  4. Windows will almost certainly exist on /dev/sda1: mount /dev/sda1 /mnt
  5. Reinstall GRUB in the MBR: grub-install --root-directory=/mnt/ /dev/sda
  6. Reboot: shutdown -r now
  7. Restore the GRUB menu: update-grub

You could also install 100% Unix, Linux, or BSD and simply run Windows in a virtual machine if the computer is strong enough for that.

Also: your computer's BIOS may have an option to protect the boot sector.



open gparted , right click the partition that has Grub in it, go to manage flags and mark boot.


Kako z uporabo ukazne vrstice vidimo vse procese, ki se izvajajo na linux napravi?

How do I see all running process in Linux operating systems using command line or GUI options?

You need to use the ps command. It provide information about the currently running processes, including their process identification numbers (PIDs). Both Linux and UNIX support the ps command to display information about all running process. The ps command gives a snapshot of the current processes. If you want a repetitive update of this status, use top, atop, and/or htop command as described below.


Apart from ps command, you can also use the following commands to display info about processes on Linux:

  1. top command : Display and update sorted information about processes.
  2. atop : Advanced System & Process Monitor.
  3. htop : Interactive process viewer.

The ps command

Type the following ps command to display all running process:

ps aux | less                                                                                                                                                            


  • -A: select all processes
  • a: select all processes on a terminal, including those of other users
  • x: select processes without controlling ttys

Task: see every process on the system

ps -A                                                                                                                                                                         
ps -e                                                                                                                                                                        

Task: See every process except those running as root

ps -U root -u root -N                                                                                                                                                 

Task: See process run by user andrej

ps -u andrej                                                                                                                                                               

Task: top command

The top program provides a dynamic real-time view of a running system. Type the top at command prompt:




To quit press q, for help press h.

Task: display a tree of processes

pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified, all process trees rooted at processes owned by that user are shown.


Sample outputs:


Task: Print a process tree using ps

ps -ejH
ps axjf


Task: Get info about threads

Type the following command:

ps -eLf
ps axms


Task: Get security info

Type the following command:

ps -eo euser,ruser,suser,fuser,f,comm,label
ps axZ
ps -eM

Task: Save Process Snapshot to a file

Type the following command:

top -b -n1 > /tmp/process.log

Or you can email result to yourself:

top -b -n1 | mail -s 'Process snapshot'

Task: Lookup process

Use pgrep command. pgrep looks through the currently running processes and lists the process IDs which matches the selection criteria to screen. For example display firefox process id:

pgrep firefox

Sample outputs:


Following command will list the process called sshd which is owned by a user called root:

pgrep -u root sshd

Say hello to htop and atop

htop is interactive process viewer just like top, but allows to scroll the list vertically and horizontally to see all processes and their full command lines. Tasks related to processes (killing, renicing) can be done without entering their PIDs. To install htop type command:

apt-get install htop


yum install htop

Now type the htop command at the shell prompt:



Sample outputs:



Kateri proces posluša na portu

How do I find out running processes were associated with each open port? How do I find out what process has open tcp port 111 or udp port 7000 under Linux?


  1. netstat - a command-line tool that displays network connections, routing tables, and a number of network interface statistics.
  2. fuser - a command line tool to identify processes using files or sockets.
  3. lsof - a command line tool to list open files under Linux / UNIX to report a list of all open files and the processes that opened them.
  4. /proc/$pid/ file system - Under Linux /proc includes a directory for each running process (including kernel processes) at /proc/PID, containing information about that process, notably including the processes name that opened port.


netstat -tulpn


Active Internet connections (only servers)
Proto Recv-Q Send-Q  Local Address      Foreign Address   State       PID/Program name
tcp   0    0*         LISTEN      1138/mysqld          
tcp   0      0*         LISTEN      850/portmap          
tcp   0      0*         LISTEN      1607/apache2       
tcp   0      0*         LISTEN      910/rpc.statd         
tcp   0      0*         LISTEN      1467/dnsmasq       
tcp   0      0*         LISTEN      992/sshd                
tcp   0      0*         LISTEN      1565/cupsd            
tcp   0      0*         LISTEN      3813/transmission 
tcp6  0      0       :::22              :::*              LISTEN      992/sshd                
tcp6  0      0       ::1:631            :::*              LISTEN      1565/cupsd            
tcp6  0      0       :::7000            :::*              LISTEN      3813/transmission 
udp   0      0*                     850/portmap          
udp   0      0*                     910/rpc.statd          
udp   0      0*                     1467/dnsmasq       
udp   0      0*                     1467/dnsmasq       
udp   0      0*                     3697/dhclient         
udp   0      0*                     3813/transmission  
udp   0      0*                     910/rpc.statd          

TCP port 3306 was opened by mysqld process having PID # 1138. You can verify this using /proc, enter:

ls -l /proc/1138/exe                                                                                               

Sample outputs:

lrwxrwxrwx 1 root root 0 2010-10-29 10:20 /proc/1138/exe -> /usr/sbin/mysqld                                       

You can use grep command to filter out information:

netstat -tulpn | grep :80                                                                                          


tcp 0 0* LISTEN 1607/apache2