Network
Wget
wget is a http clientwget http://digitalvellum.next.xxxx-labs.com/ping
Curl
Make a web request
curl -v
ppe.courseadmin.he.pearsoncmg.com/console/launch?courseId=y
File Upload
curl -v -u username:password --upload-file he-mypearson-parent-3.6.pom https://devops-tools.xxxx.com/nexus-deps/service/local/repositories/Releases/content/com/ltg/3.6-SNAPSHOT/he-myson-parent-3.6.pom
nc
Ping to a port
nc -zv 10.20.238.210 1521
Netstat
Show all network connections
netstat
netstat -cnulp
netstat -a -n | grep "LIST"
Get number of connections
netstat --tcp | wc -l
Get ports with pid
netstat -lnptu
Route
route -n
Telnet
telnet 10.52.208.59
telnet 10.52.208.59 9080
network trace
mtr 10.32.149.159
Server ………….
Get shared server info
df -h
#number of cores
nproc
# CPU architecture information
lscpu
#restart ubunutu
sudo reboot
#linux os version
uname -a
cat /etc/*-release
creating a link
ln -sf /usr/lib/firefox/firefox /usr/bin/firefox
#show all env variables sorted
env | sort
sort
ll -t
process
linux you can find the application pid by using
>> netstat -tulpn
process details
ps -ef | grep 4377
show running processors
ps -ef
kill process id 3071
kill -9 3071
>>kill whatever process using 61521 port
lsof -ti:61521 |
xargs kill -9
##kill process
pkill -f vmstat
pkill -f pidstat
Permissions
change ownership of a folder and sub
chown -R aravinda:aravinda eclipse_sts
change file permission
chmod ugo+rwx file4
#change chmod
chmod o-rw myfile
Compression
ZIP
tar -zcvf compressFileName.tar.gz folderToCompress
#extract to destination_folder
tar -xvzf env.tar.gz -C destination_folder
unzip compressFileName.zip -d folderToCompress
#unzip
tar xvzf bos03-prod-env.tar.gz
#view only
vim xxx.tar.gz
#open file
press enter on line of the file to open
#search a file in jar
find
*.jar | xargs grep className.class
Copy
scp -- ssh copy
scp courseDetails.min.js
portweb@10.52.129.12:/install/tomcat/webapps/media/javascript
ENVIRONMENT VARIABLES
SET ENVIRONMENT VARIABLES
vi /etc/environment
>> JAVA_HOME="/usr/lib/jvm/open-jdk"
source /etc/environment
#set java per session
export PATH=$PATH:/export/home/apps/jdk1.7.0_51/bin
--get java location by >>ps -ef
#show env variables
env
vi editor
show line numbers
>> :set nu
Edit File
scripts to edit file in linux
#replace 8443 with 8080
sed -i.bak 's/8443/8080/g' server.xml
#add code after using the shared thread pool'
sed -i.bak '/using the shared thread pool/r
ssh_properties.txt' server.xml
DISK SPACE
#list free disk space:
df -h
#which sub-folders spend how much disk space
du -h --max-depth=1
#top 10 largest file/directories:
du -a /var | sort -n -r | head -n 10
#memory usage per process
ps -aux
iptables
//GET request for
"http://cert.coursemgmt.he.xxxx.com/course/epa38191":Connection
reset
//java.net.SocketException: Connection reset
#from source - should connect to the source
telnet 10.52.208.59 9080
#from destination, reset ports
iptables -F
iptables -nL
memory
#free memory > buffers/cache
free -m
#processors using resources
top
Cron Tab
#cron logs
grep CRON /var/log/syslog
Disable the cronjob.
30 3 * * * bash /export/home/portal/sync_portal_enrollments.sh
SSH Tunneling
ssh -f -L 61521:dbs-b3-0301:1521 usenanu@bridge.xxxx.com -NSSH
ssh portaltest01
Nohup
nohup /export/home/portal/shared/app/jdk1.7.0_45/bin/java -jar /machineagent.jar &
service
#staring course managemtn simulatorcd /etc
sudo service httpd start
memcache
#memcache restartpkill -f memcached
nohup /export/home/apps/memcached-1.4.15/bin/memcached -v -m 1024 -p 11211 -u portweb -l $HOSTNAME > /dev/null &
or
sudo /etc/init.d/memcached start
#check memchached status
netstat -tulpn | grep 11211
ps -e | grep memcached
Comments
Post a Comment