❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

Basic Linux Commands -GENERAL COMMANDS

By: Gowtham G
15 February 2024 at 03:32

We can see some general commands which should be useful for a new linux user.

jobs

β€œjobs” it displays the works which are executed by the current terminal.

jobs -l
jobs -p

jobs -l ==> [1]+ 3668  Stopped  man ls
Here,a work has been initiated (i.e man ls).This job was listed.
[1] ==> Job ID.
3668 ==> PID stands for Process ID.
Stopped ==> This work is currently stopped.
NOTE :
PID should be any digit,not only six digit.It could a single digit also.

fg %job_ID
bg %job_ID

Above commands represents foreground and background process.
fg %job_ID (i.e job_ID = 1).It execute the work in foreground.
bg %job_ID.It execute the work in background.

runlevel 
sudo runlevel

Runlevels are predefined operating states or configurations that determine which processes and services are running.It range from 0 – 6.
0 ==> Halt or Shutdown the system.
1 ==> Single-user mode [ used for system maintenance or troubleshooting].
2 ==> Basic multi-user mode without networking.
3 ==> Full multi-user mode with networking.
4 ==> Not commonly used but can be customized for specific purposes.
5 ==> Full multi-user mode with networking and a graphical user interface.
6 ==> Reboot the system.

init 0 - 6

User can use any one of those range mentioned above using init command.

ps

β€˜ps’ displays information about a selection of the active processes.

ps -x
ps -A
ps aux

ps -x ==> displays the information with PID and STAT.
ps -A ==> displays with PID only.
ps aux ==> displays every information.both user and root.

ps -ef
ps -ef | grep process_name

This shows the system process which is used widely.We can filter the process by using grep.

pstree

It displays the system process in a tree structure.

pstree -p username

-p ==> pass your username or root.
It displays the specific users tree structure.

kill -l

To kill a process we can use the command kill.
kill -l ==> It lists the KILL Commands.

kill -9 1527
kill -SIGKILL 1527

Let’s assume,a program (Gimp) got stuck while processing.We need to shutdown the program,but it can’t works on GUI.So we need to forcefully kill the process.For that,
we need to mention a kill command [ 9 ] to kill the process having a Process ID [ 1527 ] of Gimp.User can also use β€œ-SIGKILL” instead of β€˜-9’.

NOTE :
If we didn’t mention kill number,it will take ’15’ by default which is a soft kill process.
We must enter the PID of that process not name.

killall gimp

Killall will kill the entire gimp program.
Here,we can use the name of the program.No need to use the PID.

top
top -u username

The top program provides a dynamic real-time view of a running system. It can display system summary
information as well as a list of processes or threads currently being managed by the Linux kernel. The
types of system summary information shown and the types, order and size of information displayed for
processes are all user configurable and that configuration can be made persistent across restarts.

top -u username ==> We can filter it with a specific user.

That’s it…!

❌
❌