Linux Commands

Linux daily used command.

pwd: show current working directory

Command: pwd
Output:
/home/ubuntu

cd: Change directory

Command: cd /directoryname
i.e cd /home

mkdir: Create a new directory

Command: mkdir {directoryname}

rm -rf: Delete files and directory

Command: rm -rf {directory}

ls: List of directory

Command: ls
Output: bin  games  include  lib  local  sbin  share  src


ll: List of the directory with details

Command: ll
Output: 
drwxr-xr-x  10 root root  4096 Aug 10 17:57 ./
drwxr-xr-x   2 root root 24576 Dec 18 06:42 bin/
drwxr-xr-x   5 root root  4096 Sep 10 08:21 include/


top: The program produces an ordered list of running processes selected by user-specified criteria

Command: top
Output
top - 17:08:55 up 155 days, 23:10,  1 user,  load average: 0.000.000.00
Tasks:  98 total,   1 running,  57 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1002108 total,   143040 free,   625612 used,   233456 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   227784 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
 3409 ubuntu    20   0 2423768 452520      0 S  0.3 45.2  50:43.27 java
    1 root      20   0  159976   5364   2832 S  0.0  0.5   1:39.48 systemd
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.14 kthreadd


htop: htop is an interactive system-monitor process-viewer and process-manager. It is designed as an alternative to the Unix program top.

Command: htop
Output:



kill: kill the running process

Command: kill -9 pid
i.e kill -9 1221


history: It returns the list of all previously executed commands.

Command: history
Output:
208  ls
  209  ll
  210  top
  211  htop
  212  top
  213  hostory
tail: The tail command is used to print the last 10 lines of a file by default.

Command: tail
Output:
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:553)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:260)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1594)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:834)


tail -f: Output the content of the file as it grows to start with the last 10 lines.

Command: tail -f
Output:
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:553)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:260)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1594)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:834)


Check the application running PID.

Command: ps aux | grep 'java -jar';
ubuntu    3409  0.1 45.1 2423768 452520 ?  Sl  2020  50:44 
java -jar -Dspring.profiles.active=aws app.jar


No comments:

Post a Comment