Unix & Windows Basic Commands

Dr. Rajeev Rathor
2 min readJun 23, 2023

Get detail about Linux system like detail of os, number of bits os etc.
$ uname -a
Linux rajeev-VirtualBox 4.4.0–78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64 x86_64 x86_64 GNU/LinuxGet Detail of current user details:
$whoami[History of commands]List out command that were executed in current session.
$history
Find last 100 commands executed in current session.
$history 100Z

Set software component or service in system environment
$ sudo vi ~/.bashrcMemory Usage of Unix System

Check hard disk usage:
$df -h

Check process or services are running. [Task Manager] Details of CPU utilization, memory usage, PID and many more details.

Change the owner of file or folder
$sudo chown -R userName:groupName file_or_dir_path

Change permission on file or directory
$sudo chmod 644 file or Directory pathRead 500 line from last line of logs
$tail -500f log_path

Truncate or Delete contents of log or File:
$ sudo truncate zeppelin-zeppelin.log –size 0

Find service or process running.
$ps -aef|grep “processName”

Copy file from one unix system to another unix system.
$scp /home/testuser/dummyFile/ABC.zip user_name@remote_system_IP: ~/remote_System_dir_locationExample: scp /home/testuser/dummyFile/ABC.zip user_name@10.20.30.40: ~/remote_System_dir_location

Remove or Uninstall application from Ubuntu:

$sudo apt-get remove application_Name

OR
$sudo apt-get purge application_Name

List of Services Running on Port:
$ sudo lsof -i:port_number OR
$netstat -plten | grep LISTEN | grep 8080
kill Services Running on particular Port:
$kill -9 $(lsof -t -i:8080)

kill Services Running on particular Port: $kill -9 $(lsof -t -i:8080)

Window: Get the list of Services’s PID running on given:
netstat -ano|findstr “PID :8081

Window: Kill the service by PID

taskkill /pid 48748 /f

--

--

Dr. Rajeev Rathor

PhD [IOT+AI], M.Tech [CSE] , B.Tech, 14 Years exp s from Product Development in Java, Backend, Data Engineering, IOT plaeform