Sunday, September 25, 2022

Identifying 'Who Am I' on Ubuntu

1. To Get The Processor Information

(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop$ more /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 78 model name : Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz stepping : 3 microcode : 0xf0 cpu MHz : 2000.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs b ts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave a vx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdse ed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple pml bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds mmio_stale_data retbleed bogomips : 3999.93 clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 78 model name : Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz stepping : 3 microcode : 0xf0 cpu MHz : 999.644 cache size : 3072 KB physical id : 0 siblings : 4 core id : 1 cpu cores : 2 apicid : 2 initial apicid : 2 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs b ts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave a vx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdse ed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple pml bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds mmio_stale_data retbleed bogomips : 3999.93 clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management: processor : 2 vendor_id : GenuineIntel cpu family : 6 model : 78 model name : Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz stepping : 3 microcode : 0xf0 cpu MHz : 1000.005 cache size : 3072 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs b ts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave a vx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdse ed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple pml bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds mmio_stale_data retbleed bogomips : 3999.93 clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management: processor : 3 vendor_id : GenuineIntel cpu family : 6 model : 78 model name : Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz stepping : 3 microcode : 0xf0 cpu MHz : 2000.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 1 cpu cores : 2 apicid : 3 initial apicid : 3 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs b ts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave a vx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdse ed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple pml bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds mmio_stale_data retbleed bogomips : 3999.93 clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management: To get the Processor model use the below command in a terminal: $ cat /proc/cpuinfo | grep 'name'| uniq To get the information about number of processors: $ cat /proc/cpuinfo | grep process| wc -l $ cat /proc/cpuinfo | grep 'name'| uniq model name : Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz $ cat /proc/cpuinfo | grep process| wc -l 4

From One More System:

(base) ashish@ashishdesktop:~$ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Core(TM)2 CPU 4300 @ 1.80GHz stepping : 2 microcode : 0x5d cpu MHz : 1795.029 cache size : 2048 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl cpuid aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lahf_lm pti dtherm bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit bogomips : 3590.05 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Core(TM)2 CPU 4300 @ 1.80GHz stepping : 2 microcode : 0x5d cpu MHz : 1795.029 cache size : 2048 KB physical id : 0 siblings : 2 core id : 1 cpu cores : 2 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl cpuid aperfmperf pni dtes64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm lahf_lm pti dtherm bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit bogomips : 3590.05 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management:

2. Getting Your Own Username

(base) ashish@ashishdesktop:~$ whoami ashish

3. Getting Your IP Address on The Network

(base) ashish@ashishdesktop:~$ ifconfig ens33: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether 00:e0:4c:3c:16:6b txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 320 bytes 36546 (36.5 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 320 bytes 36546 (36.5 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlx00e02d420fcb: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.106 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::1cdd:53e7:d13a:4f52 prefixlen 64 scopeid 0x20<link> inet6 2401:4900:47f1:ad21:8d1d:6756:3730:f38b prefixlen 64 scopeid 0x0<global> inet6 2401:4900:47f1:ad21:ca26:3ad6:25b6:84af prefixlen 64 scopeid 0x0<global> ether 00:e0:2d:42:0f:cb txqueuelen 1000 (Ethernet) RX packets 5930 bytes 7184630 (7.1 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 4448 bytes 530557 (530.5 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

4. Getting What Were The Last Thousand Commands or Last Ten Commands by The User

(base) ashish@ashishdesktop:~$ history | head 1 touch stocks_20220202.txt 2 ls 3 ls -l 4 chmod 777 Anaconda3-2021.11-Linux-x86_64.sh 5 ./Anaconda3-2021.11-Linux-x86_64.sh 6 conda install yfinance -c conda-forge 7 conda install pandas_datareader -c conda-forge 8 pip install pandas_datareader 9 curl 10 curl --help (base) ashish@ashishdesktop:~$ history | tail 101 pwd 102 sudo apt install git 103 ls 104 gedit 105 nano 106 cat /proc/cpuinfo 107 whoami 108 ifconfig 109 history | head 110 history | tail

5. Getting a Listing of Most of The Commands Available on The System

(base) ashish@ashishdesktop:~$ help GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) These shell commands are defined internally. Type `help' to see this list. Type `help name' to find out more about the function `name'. Use `info bash' to find out more about the shell in general. Use `man -k' or `info' to find out more about commands not in this list. A star (*) next to a name means that the command is disabled. job_spec [&] history [-c] [-d offset] [n] or history -anrw [filename] or history> (( expression )) if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ > . filename [arguments] jobs [-lnprs] [jobspec ...] or jobs -x command [args] : kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill > [ arg... ] let arg [arg ...] [[ expression ]] local [option] name[=value] ... alias [-p] [name[=value] ... ] logout [n] bg [job_spec ...] mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [> bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r k> popd [-n] [+N | -N] break [n] printf [-v var] format [arguments] builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir] caller [expr] pwd [-LP] case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars]> cd [-L|[-P [-e]] [-@]] [dir] readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd]> command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] or readonly -p compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wor> return [n] complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G gl> select NAME [in WORDS ... ;] do COMMANDS; done compopt [-o|+o option] [-DEI] [name ...] set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...] continue [n] shift [n] coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...] declare [-aAfFgiIlnrtux] [-p] [name[=value] ...] source filename [arguments] dirs [-clpv] [+N] [-N] suspend [-f] disown [-h] [-ar] [jobspec ... | pid ...] test [expr] echo [-neE] [arg ...] time [-p] pipeline enable [-a] [-dnps] [-f filename] [name ...] times eval [arg ...] trap [-lp] [[arg] signal_spec ...] exec [-cl] [-a name] [command [argument ...]] [redirection ...] true exit [n] type [-afptP] name [name ...] export [-fn] [name[=value] ...] or export -p typeset [-aAfFgiIlnrtux] [-p] name[=value] ... false ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command] umask [-p] [-S] [mode] fg [job_spec] unalias [-a] name [name ...] for NAME [in WORDS ... ] ; do COMMANDS; done unset [-f] [-v] [-n] [name ...] for (( exp1; exp2; exp3 )); do COMMANDS; done until COMMANDS; do COMMANDS; done function name { COMMANDS ; } or name () { COMMANDS ; } variables - Names and meanings of some shell variables getopts optstring name [arg ...] wait [-fn] [-p var] [id ...] hash [-lr] [-p pathname] [-dt] [name ...] while COMMANDS; do COMMANDS; done help [-dms] [pattern ...] { COMMANDS ; }

6. Present Working Directory

(base) ashish@ashishdesktop:~/Desktop/moni$ pwd /home/ashish/Desktop/moni

7. Getting Information About The User Through Environment Variables

(base) ashish@ashishdesktop:~/Desktop/moni$ echo $USER ashish (base) ashish@ashishdesktop:~/Desktop/moni$ echo $HOME /home/ashish

8. Getting The Information About The Operating System

8.1: $ uname -a Linux ashishdesktop 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux 8.2: $ uname Linux 8.3: $ hostnamectl Static hostname: ashishlaptop Icon name: computer-laptop Chassis: laptop Machine ID: 67709590ff664196b5c2eed56b83eb45 Boot ID: 1741f166cc4b4adda434ed6df857e9d2 Operating System: Ubuntu 22.04.1 LTS Kernel: Linux 5.15.0-52-generic Architecture: x86-64 Hardware Vendor: Lenovo Hardware Model: Lenovo ideapad 130-15IKB 8.4: $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy

Note: Commands 8.3 and 8.4 won't work in Termux on Android device.

9. Find out what shell I am using on Ubuntu

Please note that $SHELL is the shell for the current user but not necessarily the shell that is running at the moment. Try the following examples: (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~$ echo $SHELL /bin/bash (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~$ sh $ echo $SHELL /bin/bash $ ps -p $$ PID TTY TIME CMD 24437 pts/1 00:00:00 sh $

Errors You Will Notice When Some of The Commonly Known Shells Are Not Available on Your System

(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~$ ksh Command 'ksh' not found, but can be installed with: sudo apt install ksh93u+m # version 1.0.0~beta.2-1, or sudo apt install mksh # version 59c-16 (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~$ csh Command 'csh' not found, but can be installed with: sudo apt install csh # version 20110502-7, or sudo apt install tcsh # version 6.21.00-1.1 (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~$ tcsh Command 'tcsh' not found, but can be installed with: sudo apt install tcsh

How do I check which shell am I using?

Use the ps command with -p {pid} option. The following command selects the processes whose process ID numbers appear in pid. Use the following command to find out which shell you are in: $ ps -p $$ $ ps -p $$ PID TTY TIME CMD 24437 pts/1 00:00:00 sh $

10. Getting Your RAM Information

Human Readable

$ free -h total used free shared buff/cache available Mem: 11Gi 8.5Gi 262Mi 850Mi 2.8Gi 1.9Gi Swap: 2.0Gi 5.0Mi 2.0Gi

In MBs

$ free -m total used free shared buff/cache available Mem: 11835 8709 263 850 2862 1973 Swap: 2047 5 2042

In GBs

$ free -g total used free shared buff/cache available Mem: 11 8 0 0 2 1 Swap: 1 0 1

11. Space Taken by Various Directories in The Current Directory

(base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/ws/gh/public/pubML$ du 548 ./e4_stock_market_price_prediction/.ipynb_checkpoints 264 ./e4_stock_market_price_prediction/files_input/infy 788 ./e4_stock_market_price_prediction/files_input/nifty50 1056 ./e4_stock_market_price_prediction/files_input 2152 ./e4_stock_market_price_prediction 12 ./e2_sentiment_analysis_on_stock_market_data/files 28 ./e2_sentiment_analysis_on_stock_market_data/.ipynb_checkpoints 636 ./e2_sentiment_analysis_on_stock_market_data 6804 ./e5_sentiment_analysis_using_rnn_lstm_and_bidirectional_lstm/input/sentences_and_phrases_150k 13384 ./e5_sentiment_analysis_using_rnn_lstm_and_bidirectional_lstm/input 18592 ./e5_sentiment_analysis_using_rnn_lstm_and_bidirectional_lstm 148 ./Apriori Algorithm for Association Analysis/Two Column Format 548 ./Apriori Algorithm for Association Analysis 3596 ./weka/e2_coalindia_linear_regression/screenshots 3656 ./weka/e2_coalindia_linear_regression 56 ./weka/e1_boston_housing 3716 ./weka 65660 ./e8_bot_detection_on_twitter/input 238288 ./e8_bot_detection_on_twitter 952 ./e1_bengaluru_housing 608 ./e6_peformance testing of Sentence Transformers for sentence encoding 7024 ./e3_Prediction_of_Nifty50_index_using_LSTM_based_model/files_1/models/p5 7028 ./e3_Prediction_of_Nifty50_index_using_LSTM_based_model/files_1/models 7032 ./e3_Prediction_of_Nifty50_index_using_LSTM_based_model/files_1 136 ./e3_Prediction_of_Nifty50_index_using_LSTM_based_model/.ipynb_checkpoints 788 ./e3_Prediction_of_Nifty50_index_using_LSTM_based_model/files_input 8092 ./e3_Prediction_of_Nifty50_index_using_LSTM_based_model 212 ./e7_using twitter api to fetch trending topics, tweets and user posting them 381724 . (base) ashish@ashish-Lenovo-ideapad-130-15IKB:~/Desktop/ws/gh/public/pubML$ du -shx * | sort -rh | head -10 233M e8_bot_detection_on_twitter 19M e5_sentiment_analysis_using_rnn_lstm_and_bidirectional_lstm 8.0M e3_Prediction_of_Nifty50_index_using_LSTM_based_model 3.7M weka 2.2M e4_stock_market_price_prediction 952K e1_bengaluru_housing 636K e2_sentiment_analysis_on_stock_market_data 608K e6_peformance testing of Sentence Transformers for sentence encoding 548K Apriori Algorithm for Association Analysis 212K e7_using twitter api to fetch trending topics, tweets and user posting them

12. Check Hard Disk Usage

$ df Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 1211936 2140 1209796 1% /run This is your hard disk. /dev/sda2 959786032 42308764 868649060 5% / tmpfs 6059676 23156 6036520 1% /dev/shm tmpfs 5120 4 5116 1% /run/lock /dev/sda1 523244 5364 517880 2% /boot/efi tmpfs 1211932 4752 1207180 1% /run/user/1000 This is your external storage device. /dev/sdb1 999743488 636278784 363464704 64% /media/ashish/6137-6435 $ df -h Filesystem Size Used Avail Use% Mounted on tmpfs 1.2G 2.1M 1.2G 1% /run /dev/sda2 916G 41G 829G 5% / tmpfs 5.8G 23M 5.8G 1% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock /dev/sda1 511M 5.3M 506M 2% /boot/efi tmpfs 1.2G 4.7M 1.2G 1% /run/user/1000 /dev/sdb1 954G 607G 347G 64% /media/ashish/6137-6435
Tags: Technology,Linux

No comments:

Post a Comment