Advertisement
thesuhu

Linux Commands

Jan 30th, 2020 (edited)
667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.72 KB | None | 0 0
  1. # lihat waktu UTC lokal dan internet
  2. date -d "$(curl -sI google.com| grep -i '^date:'|cut -d' ' -f2-)"
  3. date -u -d "$(curl -sI google.com | grep -i '^date:' | cut -d' ' -f2-)"
  4.  
  5. # figure out the process id (pid)
  6. netstat -tulp | grep kubectl
  7.  
  8. # kill application
  9. sudo kill <<PID>>
  10.  
  11. # no hangup
  12. nohub
  13.  
  14. # open port di firewall
  15. sudo firewall-cmd --permanent --add-port=80/tcp
  16.  
  17. # melihat list port di firewall
  18. sudo firewall-cmd --list-port
  19.  
  20. # remove port
  21. sudo firewall-cmd --remove-port=6379/tcp --permanent
  22.  
  23. # restart service firewall
  24. sudo firewall-cmd --reload
  25.  
  26. # Check os version in Linux
  27. # debian
  28. cat /etc/os-release
  29. lsb_release -a
  30. # CentOs
  31. hostnamectl
  32.  
  33. # kernel version
  34. uname -r
  35.  
  36. # another option
  37. cat /proc/version
  38. cat /etc/issue
  39. more /etc/issue
  40. less /etc/issue
  41.  
  42. # The procedure to run the .sh file shell script on Linux is as follows:
  43. # Set execute permission on your script:
  44. chmod +x script-name-here.sh
  45. #To run your script, enter:
  46. ./script-name-here.sh
  47. # OR
  48. sh script-name-here.sh
  49. # OR
  50. bash script-name-here.sh
  51.  
  52. # pemberian hak akses readwrite direktori, default tidak recruisive tambahkan -R untuk recruisive
  53. chmod -R 0777 /mydirectory
  54. chmod -R 0755 /my-cool-directory
  55.  
  56. # view free disk
  57. df -h
  58. df -a #shows the file system's complete disk usage even if the Available field is 0
  59.  
  60. # melihat memory
  61. free -m
  62. cat /proc/meminfo
  63. vmstat -s
  64. top
  65.  
  66. # restart linux
  67. sudo reboot
  68. shutdown -r +5
  69.  
  70. # echo dari file
  71. echo "$(<a.txt )"
  72.  
  73. # melihat info cpu
  74. cat /proc/cpuinfo
  75. # melihat jumlah thread cpu
  76. nproc --all
  77. echo "Threads: $(nproc --all)"
  78. # melihat dari konfigurasi
  79. getconf _NPROCESSORS_ONLN
  80. echo "Number of CPU/cores online at $HOSTNAME: $(getconf _NPROCESSORS_ONLN)"
  81. # socket, core cpu dll
  82. lscpu
  83. # contoh hasil
  84. Architecture:          x86_64
  85. CPU op-mode(s):        32-bit, 64-bit
  86. Byte Order:            Little Endian
  87. CPU(s):                8
  88. On-line CPU(s) list:   0-7
  89. Thread(s) per core:    1
  90. Core(s) per socket:    1
  91. Socket(s):             8
  92. NUMA node(s):          1
  93. Vendor ID:             GenuineIntel
  94. CPU family:            6
  95. Model:                 85
  96. Model name:            Intel(R) Xeon(R) Platinum 8170 CPU @ 2.10GHz
  97. Stepping:              4
  98. CPU MHz:               2095.078
  99. BogoMIPS:              4190.15
  100. Hypervisor vendor:     VMware
  101. Virtualization type:   full
  102. L1d cache:             32K
  103. L1i cache:             32K
  104. L2 cache:              1024K
  105. L3 cache:              36608K
  106. NUMA node0 CPU(s):     0-7
  107. # diringkas
  108. lscpu | grep -E '^Thread|^Core|^Socket|^CPU\('
  109.  
  110. # unzip
  111. # extract to mydir
  112. unzip wer.zip -d mydir
  113. # silent mode (-q perform  operations  quietly  (-qq  = even quieter))
  114. unzip -qq wer.zip
  115.  
  116. # zip, jangan sertakan / di belakang direktori
  117.  zip -r nginx.zip nginx
  118.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement