DEV Community

shun
shun

Posted on

Standard Linux Commands and Their Outputs

File Operations

  • ls: List directory contents
  $ ls
  file1.txt  file2.txt  dir1/
Enter fullscreen mode Exit fullscreen mode
  • pwd: Print working directory
  $ pwd
  /home/user
Enter fullscreen mode Exit fullscreen mode

Text Operations

  • cat: Display file content
  $ cat file1.txt
  This is the content of file1.
Enter fullscreen mode Exit fullscreen mode
  • head: Display the beginning of a file
  $ head file1.txt
  First line of the file.
Enter fullscreen mode Exit fullscreen mode
  • tail: Display the end of a file
  $ tail file1.txt
  Last line of the file.
Enter fullscreen mode Exit fullscreen mode

System Information

  • uname -a: Display system information
  $ uname -a
  Linux hostname 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Enter fullscreen mode Exit fullscreen mode
  • free: Display memory usage
  $ free -h
            total        used        free      shared  buff/cache   available
  Mem:      7.7Gi       1.2Gi       5.8Gi       123Mi       717Mi       6.2Gi
  Swap:     2.0Gi          0B       2.0Gi
Enter fullscreen mode Exit fullscreen mode

Networking

  • ping: Test network connection
  $ ping -c 4 google.com
  PING google.com (172.217.22.14) 56(84) bytes of data.
  64 bytes from fra15s11-in-f14.1e100.net (172.217.22.14): icmp_seq=1 ttl=53 time=29.3 ms
  ...
Enter fullscreen mode Exit fullscreen mode


`

Miscellaneous

  • echo: Display a line of text
    bash
    $ echo "Hello, World!"
    Hello, World!

  • history: Display command history
    bash
    $ history
    1 ls
    2 cd ..
    3 pwd
    ...

Top comments (0)