How to free system of useless processes in a safe way?

I am kinda new to Ubuntu. For the past 4 months, I have been setting up various development environments for various purposes, the worst thing I did was just googling how to install this or do this and following the tutorials for getting the work done without realizing or understanding how this particular installation gonna affect my system. So now I have lots of useless processes that keeps running all the time like : mongodb, mysql-server, apache, etc:

Have a look at my current ps -aux output

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  5.2  0.1 102432 11780 ?        Ss   14:04   0:01 /sbin/init sp
root           2  0.0  0.0      0     0 ?        S    14:04   0:00 [kthreadd]
root           3  0.0  0.0      0     0 ?        I<   14:04   0:00 [rcu_gp]
root           4  0.0  0.0      0     0 ?        I<   14:04   0:00 [rcu_par_gp]
root           5  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/0:0-
root           6  0.0  0.0      0     0 ?        I<   14:04   0:00 [kworker/0:0H
root           7  0.2  0.0      0     0 ?        I    14:04   0:00 [kworker/0:1-
root           8  0.3  0.0      0     0 ?        I    14:04   0:00 [kworker/u8:0
root           9  0.0  0.0      0     0 ?        I<   14:04   0:00 [mm_percpu_wq
root          10  0.0  0.0      0     0 ?        S    14:04   0:00 [rcu_tasks_ru
root          11  0.0  0.0      0     0 ?        S    14:04   0:00 [rcu_tasks_tr
root          12  0.1  0.0      0     0 ?        S    14:04   0:00 [ksoftirqd/0]
root          13  0.2  0.0      0     0 ?        I    14:04   0:00 [rcu_sched]
root          14  0.0  0.0      0     0 ?        S    14:04   0:00 [migration/0]
root          15  0.0  0.0      0     0 ?        S    14:04   0:00 [idle_inject/
root          16  0.0  0.0      0     0 ?        S    14:04   0:00 [cpuhp/0]
root          17  0.0  0.0      0     0 ?        S    14:04   0:00 [cpuhp/1]
root          18  0.0  0.0      0     0 ?        S    14:04   0:00 [idle_inject/
root          19  0.4  0.0      0     0 ?        S    14:04   0:00 [migration/1]
root          20  0.1  0.0      0     0 ?        S    14:04   0:00 [ksoftirqd/1]
root          21  0.3  0.0      0     0 ?        I    14:04   0:00 [kworker/1:0-
root          22  0.0  0.0      0     0 ?        I<   14:04   0:00 [kworker/1:0H
root          23  0.0  0.0      0     0 ?        S    14:04   0:00 [cpuhp/2]
root          24  0.0  0.0      0     0 ?        S    14:04   0:00 [idle_inject/
root          25  0.4  0.0      0     0 ?        S    14:04   0:00 [migration/2]
root          26  0.1  0.0      0     0 ?        S    14:04   0:00 [ksoftirqd/2]
root          27  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/2:0-
root          28  0.0  0.0      0     0 ?        I<   14:04   0:00 [kworker/2:0H
root          29  0.0  0.0      0     0 ?        S    14:04   0:00 [cpuhp/3]
root          30  0.0  0.0      0     0 ?        S    14:04   0:00 [idle_inject/
root          31  0.4  0.0      0     0 ?        S    14:04   0:00 [migration/3]
root          32  0.1  0.0      0     0 ?        S    14:04   0:00 [ksoftirqd/3]
root          33  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/3:0-
root          34  0.0  0.0      0     0 ?        I<   14:04   0:00 [kworker/3:0H
root          35  0.0  0.0      0     0 ?        S    14:04   0:00 [kdevtmpfs]
root          36  0.0  0.0      0     0 ?        I<   14:04   0:00 [netns]
root          37  0.0  0.0      0     0 ?        I<   14:04   0:00 [inet_frag_wq
root          38  0.0  0.0      0     0 ?        S    14:04   0:00 [kauditd]
root          39  0.1  0.0      0     0 ?        I    14:04   0:00 [kworker/2:1-
root          40  0.1  0.0      0     0 ?        I    14:04   0:00 [kworker/3:1-
root          41  0.0  0.0      0     0 ?        S    14:04   0:00 [khungtaskd]
root          42  0.0  0.0      0     0 ?        S    14:04   0:00 [oom_reaper]
root          43  0.0  0.0      0     0 ?        I<   14:04   0:00 [writeback]
root          44  0.0  0.0      0     0 ?        S    14:04   0:00 [kcompactd0]
root          45  0.0  0.0      0     0 ?        SN   14:04   0:00 [ksmd]
root          46  0.0  0.0      0     0 ?        SN   14:04   0:00 [khugepaged]
root          52  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/1:1-
root          93  0.0  0.0      0     0 ?        I<   14:04   0:00 [kintegrityd]
root          94  0.0  0.0      0     0 ?        I<   14:04   0:00 [kblockd]
root          95  0.0  0.0      0     0 ?        I<   14:04   0:00 [blkcg_punt_b
root          96  0.0  0.0      0     0 ?        I<   14:04   0:00 [tpm_dev_wq]
root          97  0.0  0.0      0     0 ?        I<   14:04   0:00 [ata_sff]
root          98  0.0  0.0      0     0 ?        I<   14:04   0:00 [md]
root          99  0.0  0.0      0     0 ?        I<   14:04   0:00 [edac-poller]
root         100  0.0  0.0      0     0 ?        I<   14:04   0:00 [devfreq_wq]
root         101  0.0  0.0      0     0 ?        S    14:04   0:00 [watchdogd]
root         102  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/u8:1
root         103  0.0  0.0      0     0 ?        I<   14:04   0:00 [kworker/1:1H
root         105  0.0  0.0      0     0 ?        S    14:04   0:00 [kswapd0]
root         106  0.0  0.0      0     0 ?        S    14:04   0:00 [ecryptfs-kth
root         108  0.0  0.0      0     0 ?        I<   14:04   0:00 [kthrotld]
root         109  0.0  0.0      0     0 ?        S    14:04   0:00 [irq/122-aerd
root         110  0.0  0.0      0     0 ?        S    14:04   0:00 [irq/123-aerd
root         111  0.0  0.0      0     0 ?        S    14:04   0:00 [irq/124-aerd
root         112  0.0  0.0      0     0 ?        I<   14:04   0:00 [acpi_thermal
root         113  0.1  0.0      0     0 ?        I    14:04   0:00 [kworker/u8:2
root         114  0.0  0.0      0     0 ?        I<   14:04   0:00 [vfio-irqfd-c
root         115  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/2:2-
root         116  0.0  0.0      0     0 ?        I<   14:04   0:00 [ipv6_addrcon
root         125  0.0  0.0      0     0 ?        I<   14:04   0:00 [kstrp]
root         128  0.0  0.0      0     0 ?        I<   14:04   0:00 [zswap-shrink
root         129  0.0  0.0      0     0 ?        I<   14:04   0:00 [kworker/u9:0
root         136  0.0  0.0      0     0 ?        I<   14:04   0:00 [charger_mana
root         168  0.0  0.0      0     0 ?        I<   14:04   0:00 [kworker/3:1H
root         187  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/1:2-
root         188  0.0  0.0      0     0 ?        I<   14:04   0:00 [kworker/2:1H
root         196  0.1  0.0      0     0 ?        I<   14:04   0:00 [kworker/0:1H
root         197  0.0  0.0      0     0 ?        S    14:04   0:00 [scsi_eh_0]
root         198  0.0  0.0      0     0 ?        I<   14:04   0:00 [scsi_tmf_0]
root         199  0.0  0.0      0     0 ?        S    14:04   0:00 [scsi_eh_1]
root         200  0.0  0.0      0     0 ?        I<   14:04   0:00 [scsi_tmf_1]
root         201  0.0  0.0      0     0 ?        S    14:04   0:00 [scsi_eh_2]
root         202  0.0  0.0      0     0 ?        I<   14:04   0:00 [scsi_tmf_2]
root         203  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/u8:3
root         204  0.2  0.0      0     0 ?        I    14:04   0:00 [kworker/0:2-
root         205  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/u8:4
root         207  0.7  0.0      0     0 ?        I    14:04   0:00 [kworker/u8:5
root         208  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/0:3-
root         234  0.0  0.0      0     0 ?        S    14:04   0:00 [jbd2/sdb2-8]
root         235  0.0  0.0      0     0 ?        I<   14:04   0:00 [ext4-rsv-con
root         283  1.6  1.0 187436 85516 ?        S<s  14:04   0:00 /lib/systemd/
root         313  2.2  0.0  24048  7288 ?        Ss   14:04   0:00 /lib/systemd/
root         318  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop0]
root         321  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/1:3-
root         322  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/1:4-
root         324  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop1]
root         329  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop2]
root         330  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop3]
root         332  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop4]
root         344  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop5]
root         357  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop6]
root         385  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop7]
root         386  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop8]
root         388  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop9]
root         390  0.1  0.0      0     0 ?        I    14:04   0:00 [kworker/3:2-
root         391  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop10]
root         394  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop11]
root         395  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop12]
root         400  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop13]
root         402  0.0  0.0      0     0 ?        S    14:04   0:00 [irq/128-mei_
root         409  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop14]
root         412  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop15]
root         414  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop16]
root         415  0.0  0.0      0     0 ?        I<   14:04   0:00 [cfg80211]
root         426  0.0  0.0      0     0 ?        I<   14:04   0:00 [kworker/u9:1
root         428  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop17]
root         430  0.0  0.0      0     0 ?        I<   14:04   0:00 [kworker/u9:2
root         431  0.0  0.0      0     0 ?        I<   14:04   0:00 [cryptd]
root         435  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop18]
root         437  0.3  0.0      0     0 ?        S    14:04   0:00 [irq/129-iwlw
root         459  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop19]
root         469  0.0  0.0      0     0 ?        S    14:04   0:00 [card0-crtc0]
root         470  0.0  0.0      0     0 ?        S    14:04   0:00 [card0-crtc1]
root         471  0.0  0.0      0     0 ?        S    14:04   0:00 [card0-crtc2]
root         473  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop20]
root         483  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop21]
root         499  0.0  0.0      0     0 ?        I<   14:04   0:00 [ttm_swap]
root         500  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop22]
root         502  0.0  0.0      0     0 ?        S    14:04   0:00 [gfx]
root         505  0.0  0.0      0     0 ?        S    14:04   0:00 [comp_1.0.0]
root         506  0.0  0.0      0     0 ?        S    14:04   0:00 [comp_1.0.1]
root         507  0.0  0.0      0     0 ?        S    14:04   0:00 [comp_1.0.2]
root         508  0.0  0.0      0     0 ?        S    14:04   0:00 [comp_1.0.3]
root         509  0.0  0.0      0     0 ?        S    14:04   0:00 [comp_1.0.4]
root         510  0.0  0.0      0     0 ?        S    14:04   0:00 [comp_1.0.5]
root         511  0.0  0.0      0     0 ?        S    14:04   0:00 [comp_1.0.6]
root         512  0.0  0.0      0     0 ?        S    14:04   0:00 [comp_1.0.7]
root         513  0.0  0.0      0     0 ?        S    14:04   0:00 [sdma0]
root         515  0.0  0.0      0     0 ?        S    14:04   0:00 [sdma1]
root         519  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop23]
root         524  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop24]
root         525  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop25]
root         532  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop26]
root         553  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop27]
root         555  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop28]
root         556  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop29]
root         557  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop30]
root         558  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop31]
root         559  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop32]
root         560  0.0  0.0      0     0 ?        S<   14:04   0:00 [loop33]
root         810  0.0  0.0  22156  5736 ?        Ss   14:04   0:00 /lib/systemd/
systemd+     843  0.6  0.1  24168 13276 ?        Ss   14:04   0:00 /lib/systemd/
systemd+     846  0.3  0.0  90260  6032 ?        Ssl  14:04   0:00 /lib/systemd/
root         849  0.0  0.0      0     0 ?        I    14:04   0:00 [kworker/3:3-
root         901  0.4  0.1 239684  8564 ?        Ssl  14:04   0:00 /usr/lib/acco
root         902  0.0  0.0   2548   716 ?        Ss   14:04   0:00 /usr/sbin/acp
avahi        905  0.2  0.0   8536  3492 ?        Ss   14:04   0:00 avahi-daemon:
root         906  0.0  0.0   8428  4460 ?        Ss   14:04   0:00 /usr/lib/blue
root         907  0.0  0.0   9756  2900 ?        Ss   14:04   0:00 /usr/sbin/cro
root         908  0.0  0.1  29196  9408 ?        Ss   14:04   0:00 /usr/sbin/cup
message+     910  4.5  0.0   9936  6460 ?        Ss   14:04   0:01 /usr/bin/dbus
root         911  3.0  0.2 337796 21544 ?        Ssl  14:04   0:00 /usr/sbin/Net
root         918  0.0  0.0  81904  3616 ?        Ssl  14:04   0:00 /usr/sbin/irq
root         924  0.4  0.2  39668 20140 ?        Ss   14:04   0:00 /usr/bin/pyth
root         927  5.4  0.1 235016 10308 ?        Ssl  14:04   0:01 /usr/lib/poli
syslog       929  0.3  0.0 224356  5048 ?        Ssl  14:04   0:00 /usr/sbin/rsy
root         935  8.3  0.4 999440 33212 ?        Ssl  14:04   0:02 /usr/lib/snap
root         940  0.0  0.0 235944  5940 ?        Ssl  14:04   0:00 /usr/libexec/
root         944  0.8  0.1  16788  8368 ?        Ss   14:04   0:00 /lib/systemd/
root         947  0.1  0.1 126224 10072 ?        Ssl  14:04   0:00 /usr/sbin/the
root         949  1.1  0.1 393656 13904 ?        Ssl  14:04   0:00 /usr/lib/udis
root         950  0.1  0.1  13940  8712 ?        Ss   14:04   0:00 /sbin/wpa_sup
avahi        956  0.0  0.0   8352   328 ?        S    14:04   0:00 avahi-daemon:
root         992  0.2  0.1 178576 13096 ?        Ssl  14:04   0:00 /usr/sbin/cup
colord       996  0.7  0.1 246636 14780 ?        Ssl  14:04   0:00 /usr/libexec/
mongodb     1001  3.8  1.2 1496392 100112 ?      Ssl  14:04   0:00 /usr/bin/mong
root        1009  2.3  0.1 527256  9756 ?        Ssl  14:04   0:00 /snap/canonic
root        1019  0.2  0.1 313756 10836 ?        Ssl  14:04   0:00 /usr/sbin/Mod
root        1023  0.3  0.0  16264  5724 ?        Ss   14:04   0:00 /lib/systemd/
root        1045  0.5  0.5 1047080 46888 ?       Ssl  14:04   0:00 /usr/bin/cont
root        1079  0.1  0.1 239952  8816 ?        Ssl  14:04   0:00 /usr/sbin/gdm
root        1087  0.3  0.2 118468 22768 ?        Ssl  14:04   0:00 /usr/bin/pyth
debian-+    1098  2.3  0.4  38652 33852 ?        Ss   14:04   0:00 /usr/bin/tor 
mysql       1121  3.7  4.7 2128896 383016 ?      Ssl  14:04   0:00 /usr/sbin/mys
root        1122  0.0  0.1 163580  8704 ?        Ssl  14:04   0:00 /usr/lib/Netw
root        1135  0.0  0.0  13640  5172 ?        Ss   14:04   0:00 /usr/sbin/apa
www-data    1136  0.0  0.1 1942204 11168 ?       Sl   14:04   0:00 /usr/sbin/apa
www-data    1137  0.0  0.1 1942204 11116 ?       Sl   14:04   0:00 /usr/sbin/apa
postgres    1143  0.0  0.3 218636 29212 ?        Ss   14:04   0:00 /usr/lib/post
gdm         1200  1.0  0.1  19028 10220 ?        Ss   14:04   0:00 /lib/systemd/
gdm         1201  0.0  0.0 103708  3904 ?        S    14:04   0:00 (sd-pam)
postgres    1212  0.0  0.0 218636  4472 ?        Ss   14:04   0:00 postgres: 12/
postgres    1213  0.0  0.0 218636  6116 ?        Ss   14:04   0:00 postgres: 12/
postgres    1214  0.0  0.1 218636 10188 ?        Ss   14:04   0:00 postgres: 12/
postgres    1215  0.0  0.0 219180  7116 ?        Ss   14:04   0:00 postgres: 12/
postgres    1216  0.0  0.0  73000  4924 ?        Ss   14:04   0:00 postgres: 12/
postgres    1217  0.0  0.0 219176  7000 ?        Ss   14:04   0:00 postgres: 12/
gdm         1235  0.5  0.3 511856 24552 ?        SNsl 14:04   0:00 /usr/libexec/
gdm         1239  0.1  0.0   7400  4420 ?        Ss   14:04   0:00 /usr/bin/dbus
rtkit       1242  0.0  0.0 152940  2960 ?        SNsl 14:04   0:00 /usr/libexec/
gdm         1256  0.0  0.0 240048  7684 ?        Ssl  14:04   0:00 /usr/libexec/
gdm         1271  0.0  0.0 312808  6256 ?        Sl   14:04   0:00 /usr/libexec/
gdm         1278  2.4  0.1 314396  9784 ?        Ssl  14:04   0:00 /usr/libexec/
gdm         1311  0.0  0.1 317060  9012 ?        Ssl  14:04   0:00 /usr/libexec/
gdm         1321  0.0  0.0 238316  6740 ?        Ssl  14:04   0:00 /usr/libexec/
gdm         1333  0.0  0.0 236040  6380 ?        Ssl  14:04   0:00 /usr/libexec/
gdm         1337  0.0  0.0 236212  6276 ?        Ssl  14:04   0:00 /usr/libexec/
gdm         1342  0.3  0.4 545372 36252 ?        Sl   14:04   0:00 /usr/libexec/
gdm         1364  0.0  0.1 315092  9092 ?        Sl   14:04   0:00 /usr/libexec/
root        1376  0.4  0.1 252712 10128 ?        Ssl  14:04   0:00 /usr/lib/upow
gdm         1440  0.3  0.2 361312 22160 ?        Ssl  14:04   0:00 /usr/libexec/
root        1563  0.3  0.0  16268  5808 ?        Ss   14:04   0:00 /lib/systemd/
geoclue     1584  0.5  0.1 279872 11828 ?        Ssl  14:04   0:00 /usr/libexec/
root        1585  2.1  0.9 485456 75256 ?        Ssl  14:04   0:00 /usr/lib/pack
root        1707  0.1  0.0 225760  7824 ?        Ssl  14:04   0:00 /usr/libexec/
root        1799  0.2  0.1 167548 10788 ?        Sl   14:04   0:00 gdm-session-w
root        1815  1.5  1.1 1021008 89784 ?       Ssl  14:04   0:00 /usr/bin/dock
whoopsie    1818  0.4  0.1 253128 15612 ?        Ssl  14:04   0:00 /usr/bin/whoo
kernoops    1819  0.0  0.0  11264   452 ?        Ss   14:04   0:00 /usr/sbin/ker
kernoops    1821  0.0  0.0  11264   448 ?        Ss   14:04   0:00 /usr/sbin/ker
root        1826  1.4  0.1 1142532 11420 ?       Sl   14:04   0:00 /opt/teamview
root        1860  0.0  0.0   2496   520 ?        S    14:04   0:00 bpfilter_umh
xyz         2038  1.5  0.1  19280 10548 ?        Ss   14:04   0:00 /lib/systemd/
xyz         2039  0.0  0.0 104100  3964 ?        S    14:04   0:00 (sd-pam)
xyz         2044  0.6  0.2 1220796 19304 ?       S<sl 14:04   0:00 /usr/bin/puls
xyz         2046  1.6  0.3 512168 25084 ?        SNsl 14:04   0:00 /usr/libexec/
xyz         2050  1.3  0.0   8148  5288 ?        Ss   14:04   0:00 /usr/bin/dbus
xyz         2065  0.0  0.0 240048  7568 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2067  0.3  0.0 240520  7688 ?        Sl   14:04   0:00 /usr/bin/gnom
xyz         2074  0.0  0.0 312808  6516 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2081  1.0  0.1 314424  9692 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2087  0.0  0.1 317060  8556 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2092  0.0  0.0 238316  6380 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2096  0.0  0.0 236040  5980 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2103  0.0  0.0 236832  6904 ?        Ssl  14:04   0:00 /usr/libexec/
root        2104  0.0  0.0      0     0 ?        S<   14:04   0:00 [krfcommd]
xyz         2108  3.4  0.8 696364 71428 ?        SLl  14:04   0:00 /usr/libexec/
xyz         2115  0.0  0.1 315092  8668 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2124  1.6  0.3 435216 27560 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2136  0.0  0.0 164356  6568 tty2     Ssl+ 14:04   0:00 /usr/lib/gdm3
xyz         2138  5.7  0.9 1650476 76436 tty2    Sl+  14:04   0:00 /usr/lib/xorg
xyz         2163  0.1  0.1 188560 13752 tty2     Sl+  14:04   0:00 /usr/libexec/
xyz         2231  0.0  0.0   6040   452 ?        Ss   14:04   0:00 /usr/bin/ssh-
xyz         2253  0.0  0.0 305436  6860 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2258  0.0  0.0   7248  4344 ?        S    14:04   0:00 /usr/bin/dbus
xyz         2268  0.0  0.0 240228  7616 ?        Sl   14:04   0:00 /usr/bin/gnom
xyz         2271  0.0  0.0  90400  4404 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2281  0.6  0.1 410760 15784 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2295 15.8  2.2 4257528 180756 ?      Ssl  14:04   0:02 /usr/bin/gnom
xyz         2319  0.0  0.1 311284  8240 ?        Sl   14:04   0:00 ibus-daemon -
xyz         2323  0.0  0.0 236884  7244 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2324 11.4  0.3 273112 28676 ?        Sl   14:04   0:01 /usr/libexec/
xyz         2326  1.1  0.2 193828 23776 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2332  0.0  0.0 236840  7148 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2339  0.0  0.0 162840  7652 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2346  0.0  0.0 235932  4072 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2348  0.3  0.2 802200 19708 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2357  1.4  0.4 689316 34132 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2365  0.0  0.0 156624  5968 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2368  0.0  0.0 162524  5952 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2377  1.6  0.5 1350272 40484 ?       Ssl  14:04   0:00 /usr/libexec/
xyz         2381  0.4  0.3 2734032 26228 ?       Sl   14:04   0:00 /usr/bin/gjs 
xyz         2395  0.0  0.0 310016  6352 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2396  1.9  0.3 574404 26256 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2397  0.1  0.1 373976 15928 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2398  0.1  0.0 312080  7168 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2399  1.3  0.3 415704 25044 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2400  1.5  0.3 1102024 27640 ?       Ssl  14:04   0:00 /usr/libexec/
xyz         2401  1.3  0.3 489756 25064 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2402  0.0  0.1 322304 11232 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2403  0.0  0.0 457436  6104 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2405  0.0  0.0 235844  5844 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2406  0.0  0.0 163028  7184 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2409  0.2  0.1 465268 10328 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2410  0.0  0.1 389244  8404 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2414  0.0  0.1 319708  9008 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2416  0.0  0.0 459048  7040 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2424  1.3  0.2 341408 24172 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2428  0.0  0.0 388068  7704 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2430  1.3  0.3 342684 25648 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2438  0.4  0.3 747276 29776 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2480  0.0  0.1 342524 15260 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2507  0.0  0.0 231800  5932 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2515  2.5  0.7 636116 58424 ?        Sl   14:04   0:00 /usr/libexec/
xyz         2519  7.3  0.6 3844756 53852 ?       Sl   14:04   0:00 /opt/xdman/jr
xyz         2561 17.4  0.5 978892 45452 ?        Sl   14:04   0:02 /snap/snap-st
xyz         2586  0.0  0.0 457868  6424 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2728  0.2  0.1 462944 10508 ?        Ssl  14:04   0:00 /usr/libexec/
xyz         2732  0.8  0.3 490568 26252 ?        Ssl  14:04   0:00 /usr/libexec/
root        2754  2.7  0.3 379264 26820 ?        Ssl  14:04   0:00 /usr/libexec/
root        2759  0.3  0.0 238804  7444 ?        Ssl  14:04   0:00 /usr/lib/bolt
xyz         2771  4.8  0.6 859956 54432 ?        Rsl  14:04   0:00 /usr/libexec/
xyz         2779  0.5  0.1  14384  8400 pts/0    Ss   14:04   0:00 bash
_apt        3032  2.0  0.1  27056 13024 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3033  0.5  0.1  27056 13096 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3034  0.0  0.1  24152  9680 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3035  0.5  0.1  27056 12972 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3036  0.0  0.1  27056 13000 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3037  0.0  0.1  24152  9608 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3038  0.0  0.1  24152  9592 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3039  0.0  0.1  24156  9728 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3040  0.5  0.1  27056 13040 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3041  1.0  0.1  27056 13032 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3042  1.0  0.1  27056 12856 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3043  0.5  0.1  24152  9696 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3044  0.5  0.1  24152  9564 ?        S    14:04   0:00 /usr/lib/apt/
_apt        3052  2.0  0.0  17808  6984 ?        S    14:04   0:00 /usr/lib/apt/
_apt        4808  0.0  0.0  18108  7836 ?        S    14:04   0:00 /usr/lib/apt/
_apt        4908  0.0  0.0  17808  3172 ?        S    14:04   0:00 /usr/lib/apt/
_apt        4909  0.0  0.0   2616  1748 ?        S    14:04   0:00 /bin/sh /usr/
xyz         4927  0.0  0.0  12028  3456 pts/0    R+   14:04   0:00 ps -aux

Now I want to free up my CPU usage from everything except the ones which are important for the system.
Is there any safe and easier way to achieve this?


Solution 1:

Is there any safe and easier way to achieve this?

Either remove the corresponding software or disable the service from starting at boot (where you can still start/stop it manually when you need/no more need it).

In regards to the latter your question needs more focus; I searched the 2 important ones for you ...

  • MySQL has its own topic on this How to disable MySQL server from constantly running in the background?

  • Apache too How do I stop Apache2 from automatically starting on boot?

and for any other user installed server software there will be a similar method. Each of the processes you do not want active after a boot will need to google the method for.

Generic answer if the process is started from a service. To disable/start/stop:

sudo systemctl disable {service}
sudo service {service} start
sudo service {service} stop

where {service} could be for instance mysql or apache2 or mongodb.