-
How to check if my Ubuntu is placed on SSD?
A simple way to tell if your OS is installed on SSD or not is to run a command from a terminal window called lsblk -o name,rota. Look at the ROTA column of the output and there you will see numbers. A 0 means no rotation speed or SSD drive. A 1 would indicate a drive with platters that rotate. My Ubuntu is installed on my /dev/sdb drive, so we can see that one indicates a 0 which means it is installed on a SSD drive. I put after this example of how to tell where your OS is installed using df. NOTE: Ubuntu that is installed as a client…
-
8 commands to check cpu information on Linux
CPU hardware information The cpu information includes details about the processor, like the architecture, vendor name, model, number of cores, speed of each core etc. There are quite a few commands on linux to get those details about the cpu hardware, and here is a brief about some of the commands. 1. /proc/cpuinfo The /proc/cpuinfo file contains details about individual cpu cores. Output its contents with less or cat. $ less /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz stepping : 10 microcode : 0xa07 cpu MHz : 1998.000 cache size : 2048 KB…
-
List all IP addresses connected to Server
Below is an example of Unix command to list all the IP addresses connected to your server on port 80. You can customize for another port. netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head Output – Total connections by IP, from highest to lowest. 97 114.198.236.10056 67.166.157.19444 170.248.43.7638 141.0.9.2037 49.248.0.237 153.100.131.1231 223.62.169.7330 65.248.100.25329 203.112.82.12829 182.19.66.187 Note This command is useful to detect if your server is under attack, and null route those IPs. Read this null route attacker IP story. Let break above lengthy command into pieces : 1. netstat -tn 2>/dev/null Uses netstat…
-
How To Find All Files Contain Specific Text
Do the following: grep -rnw '/path/to/somewhere/' -e 'pattern' -r or -R is recursive, -n is line number, and -w stands for match the whole word. -l (lower-case L) can be added to just give the file name of matching files. Along with these, --exclude, --include, --exclude-dir flags could be used for efficient searching: This will only search through those files which have .c or .h extensions: grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern" This will exclude searching all the files ending with .o extension: grep --exclude=*.o -rnw '/path/to/somewhere/' -e "pattern" For directories it’s possible to exclude a particular directory(ies) through --exclude-dir parameter. For example, this will exclude the dirs dir1/, dir2/…
-
Linux : Check Listening Port on Service
Open your terminal and type as lsof -i :8000 that command will list you the application used by that port with PID. (If no results run via sudo since your might have no permission to certain processes.) For example, with port 8000 (python3 -m http.server): $ lsof -i :8000 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME python3 3269 user 3u IPv4 1783216 0t0 TCP *:8000 (LISTEN) And port 22 (SSH): $ sudo lsof -i :22 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME sshd 998 root 3u IPv4 1442116 0t0 TCP *:ssh (LISTEN) sshd 998 root 4u IPv6 1442118 0t0 TCP *:ssh (LISTEN) Hope that helps.