Skip to content

Instantly share code, notes, and snippets.

@faizakram
Last active February 28, 2019 07:24
Show Gist options
  • Save faizakram/d8c18115ddc9088d6d310b97703c595c to your computer and use it in GitHub Desktop.
Save faizakram/d8c18115ddc9088d6d310b97703c595c to your computer and use it in GitHub Desktop.
To Kill Port On Linux
==========================
kill $(lsof -t -i:8080)
To Move File to Other Location
=============================
mv command main options:
option description
mv -f force move by overwriting destination file without prompt
mv -i interactive prompt before overwrite
mv -u update - move when source is newer than destination
mv -v verbose - print source and destination files
man mv help manual
Example:-
mv [options] source dest
Remove a full directory in Linux
=================================
rm -rf <<directoryName>>
rm -r <<directoryName>>
To Start Tomcat Server
=====================
screen ./startup.sh
To Quit file
=============
Press Esc
:q! this mean quit without save
:q this mean quit only
:wq this mean quit and save
To change Permission
========================
chmod 755 -R /opt/lampp/htdocs // For Read and download access
To Get Current Location
------------------------
pwd
To Unzip file
==================
unzip <<filename>>
To Extract tar file
=====================
tar xvf <<filename>>
To connect Mongo DB
========================
mongo --port 27017
To Show Used and Available Ram Memory
========================
free -m
To Show Used and Available Disk Memory
========================
df -h
To Show the OS name and verison
========================
cat /etc/*-release
Create the user administrator
==============================
use admin
db.createUser(
{
user: "test",
pwd: "test",
roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
}
)
To Install JDK in linux
================================
sudo yum install java-1.8.0-openjdk-devel
java -version
To Set Java Home
=========================
export JAVA_HOME="/usr/lib/jvm/java-1.8.0"
export PATH=$JAVA_HOME/bin:$PATH
To Read Only File
=====================
cat <<filename>>
Install unzip on CentOS
===========================
yum install unzip
To Install Docker in Linux
==================================
STEP 1 - Connect to Linux system
STEP 2 - Install DOCKER
sudo yum -y update
sudo yum install -y docker
docker // to docker command
docker --version // to Show the version
STEP 3 - start DOCKER
sudo service docker start
docker info // To check docker is runnning or not
docker images // this will show all the images
docker ps // it will list out the running container
docker ps -a //it will lis out all the container
docker run hello-world // this find the hello-world image in your system if not found then find form docker repository and install
sudo service docker stop // to stop docker
sudo yum remove docker // to remove docker
****************** Jenkins Installation on AWS *********************
1: Update the yum package management tool.
$ sudo yum update –y
2: Download the latest Jenkins code package.
$ sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat/jenkins.repo
3:Import a key file from Jenkins-CI to enable installation from the package.
$ sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
4: Install Jenkins.
$ sudo yum install jenkins -y
5:Start Jenkins as a service.
$ sudo service jenkins start
As noted on the user interface, you can find this password in /var/lib/jenkins/secrets/initialAdminPassword.
Paste the value into the password box, then choose Continue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment