Skip to content

Linux commands

Prayag edited this page Apr 10, 2023 · 3 revisions

[1] nullify a file

prayag@Prayag:~/workspace_eccounthg$ cat /dev/null >| .metadata/.plugins/org.eclipse.wst.server.core/tmp0/logs/eccount.log

[2] ssh

$ ssh eccount@eccount.com.np -p21
prayag@prayag:~/hacker_/draobkcalb$ cat /sys/devices/system/cpu/cpu0/cache/index2/size 
2048K

OR in debian

prayag@prayag:~/hacker_/draobkcalb$ lscpu 
Architecture:          i686
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 15
Stepping:              11
CPU MHz:               1200.000
BogoMIPS:              5199.95
L1d cache:             32K
L1i cache:             32K
L2 cache:              2048K


OR

prayag@prayag:~/hacker_/draobkcalb$ sudo dmidecode -t cache
[sudo] password for prayag: 
# dmidecode 2.11
SMBIOS 2.5 present.

Handle 0x000A, DMI type 7, 19 bytes
Cache Information
	Socket Designation: Internal Cache
	Configuration: Enabled, Not Socketed, Level 1
	Operational Mode: Write Back
	Location: Internal
	Installed Size: 32 kB
	Maximum Size: 32 kB
	Supported SRAM Types:
		Synchronous
	Installed SRAM Type: Synchronous
	Speed: Unknown
	Error Correction Type: Unknown
	System Type: Unknown
	Associativity: Unknown

Handle 0x000B, DMI type 7, 19 bytes
Cache Information
	Socket Designation: External Cache
	Configuration: Enabled, Not Socketed, Level 2
	Operational Mode: Write Back
	Location: External
	Installed Size: 2048 kB
	Maximum Size: 2048 kB
	Supported SRAM Types:
		Synchronous
	Installed SRAM Type: Synchronous
	Speed: Unknown
	Error Correction Type: Unknown
	System Type: Unknown
	Associativity: Unknown

secure copy to remote server

$ scp /home/prayagupd/.ssh/git_rsa.pub  hduser@192.168.1.168:~/

## copy from VirtualBox to host machine
$ scp ~/bin/storm/ prayagupd@192.168.1.2:vboxshared/

gunzip

gunzip < ideaIU-13.tar.gz | tar xvf -

Code refactoring using :DirDiff

:DirDiff TestPlugin1/src/java/com/zazzercode/feature1/elasticsearch/rest/action/support  TestPlugin2/src/java/com/zazzercode/das/elasticsearch/rest/action/support

download folder recursively,

wget -r --user=prayagupd --password='/aGBLB8HTPx8c' --no-parent http://dw.com/repos/dwproject/k2c/docs/requirements/

bash script

vbox version check,

#!/bin/bash                                                                                            
                                                                                                       
min=4.3                                                                                                
#current=`echo $(grails --version | head -n 2 | awk '{print $NF}' | cut -c 1-3)`                                                                                                
currentvbox=`echo $(virtualbox --help | head -n 1 | awk '{print $NF}' | cut -c 1-3)`                   
if [ 1 -eq `echo "${currentvbox} < ${min}" | bc` ]                                                     
then                                                                                                   
    echo "You have older version of virtualbox 4.2."                                                   
else                                                                                                   
    echo "Great to go"                                                                                 
fi 

phantomjs

nc -z localhost 4004 < /dev/null
 
if [ $? != 0 ]; then
ps aux | awk -v pat="/opt/phantomjs191/bin/phantomjs" '$0 ~ pat {print $2}' | xargs --no-run-if-empty kill -9
/opt/phantomjs191/bin/phantomjs /opt/phantomjs191/bin/highcharts-convert.js -host 127.0.0.1 -port 4004
fi
launchctl list
PID	Status	Label
-	0	com.apple.SafariHistoryServiceAgent
60883	0	com.apple.progressd
73032	0	com.apple.cloudphotod
92914	0	com.microsoft.wdav.tray
835	0	com.apple.Finder
747	0	com.apple.homed
980	0	com.apple.SafeEjectGPUAgent
-	0	com.apple.quicklook
-	0	com.apple.parentalcontrols.check
753	0	com.apple.mediaremoteagent
735	0	com.apple.FontWorker
10403	0	com.nexthink.collector.nxtray

Clone this wiki locally