Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, April 13, 2016

CentOS Basic Configuration

The CentOS Project is a community-driven free software effort focused on delivering a robust open source ecosystem. For users, CentOS offers a consistent manageable platform that suits a wide variety of deployments. For open source communities, CentOS offers a solid, predictable base to build upon, along with extensive resources to build, test, release, and maintain their code.

1. Find Out Installed Package


[john@linux1 /]$ rpm -qa |less
plymouth-0.8.9-0.24.20140113.el7.centos.x86_64
libsoup-2.48.1-3.el7.x86_64
libaio-0.3.109-13.el7.x86_64
dmidecode-2.12-9.el7.x86_64
passwd-0.79-4.el7.x86_64
bind-libs-lite-9.9.4-29.el7_2.2.x86_64
sed-4.2.2-5.el7.x86_64
grub2-2.02-0.34.el7.centos.x86_64
libcom_err-1.42.9-7.el7.x86_64
rsyslog-7.4.7-12.el7.x86_64
biosdevname-0.6.2-1.el7.x86_64
dracut-config-rescue-033-360.el7_2.x86_64
libacl-2.2.51-12.el7.x86_64
openssh-clients-6.6.1p1-23.el7_2.x86_64
xe-guest-utilities-6.5.0-1432.x86_64
libgcrypt-1.5.3-12.el7_1.1.x86_64
libpcap-1.5.3-8.el7.x86_64
cronie-1.4.11-14.el7.x86_64
iwl6050-firmware-41.28.5.1-43.el7.noarch
iwl4965-firmware-228.61.2.24-43.el7.noarch
iwl3160-firmware-22.0.7.0-43.el7.noarch
libunistring-0.9.3-9.el7.x86_64
iwl100-firmware-39.31.5.1-43.el7.noarch
perl-parent-0.225-244.el7.noarch
newt-0.52.15-4.el7.x86_64
perl-Pod-Escapes-1.04-286.el7.noarch
gdbm-1.10-8.el7.x86_64
perl-libs-5.16.3-286.el7.x86_64

.......

[john@linux1 /]$ rpm -qa |grep syslog

rsyslog-7.4.7-12.el7.x86_64



Saturday, February 13, 2016

Ubuntu Basic Configurations and LAMP Installation

1. Interfaces

Welcome to Ubuntu 15.10 (GNU/Linux 4.2.0-16-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

48 packages can be updated.
37 updates are security updates.

Last login: Sat Feb 13 20:16:03 2016 from 192.168.2.62
john@ubuntu15:~$ cd /etc/network
john@ubuntu15:/etc/network$ sudo vi interfaces
[sudo] password for john: 

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface -- use DHCP 
auto eth0

iface eth0 inet dhcp

# The secondart network interface -- use static ip address
auto ens160
iface ens160 inet static
address 192.168.2.22
netmask 255.255.255.0
gateway 192.168.2.1
dns-nameserver 8.8.8.8
~

~
john@ubuntu15:/etc/network$sudo /etc/init.d/networking restart


Thursday, January 14, 2016

Basic Linux Commands (Tips and Tricks)

1. Basic Commands

man : manual
ls :List Directory Contents
pwd :print working directory
cd :change directory
mkdir :Make directory
cp :Copy
mv :Move
find and locate and whereis
kill
passwd :Password
md5sum :Compute and Check MD5 Message Digest
history :History (Event) Record。
sudo :(super user do)
touch :Update the access and modification times of each FILE to the current time
chmod :change file mode bits
chown :change file owner and group
apt :Advanced Package Tool
dd: Convert and Copy a file
       root@linux:~# dd if=/home/user/Downloads/debian.iso of=/dev/sdb1 bs=512M; sync
tar : Tape Archive
cal : Calendar
cat : Concatenation. Concatenate (join) two or more plain file and/or print contents of a file on standard output.
grep : searches the given file for lines containing a match to the given strings or words
ps : (Process)
service : command controls the Starting, Stopping or Restarting of a ‘service‘
df : disk usages of file system
du : disk usages
cmp : compare
wget : a free utility for non-interactive (i.e., can work in background) download of files from the Web
mount
gcc : is the in-built compiler for ‘c‘ language in Linux Environment.
g++ is the in-built compiler for ‘C++‘ , the first object oriented programming language.
Java is one of the world’s highly used programming language and is considered fast, secure, and reliable. Most of the the web based service of today runs on java.


Wednesday, August 6, 2014

Linux : find big file in the all directories

1. Juniper Firewall  

find . -type f -size +10000 -exec ls -lh {} \; 

Sample output:

root@FW% find . -type f -size +10000 -exec ls -lh {} \; 
-rw-r--r--  1 930  929   134M Jan  5 17:34 ./cf/packages/junos-11.4R6.6-domestic
-rw-r--r--  1 root  wheel   139M Sep  8  2011 ./cf/var/log/junos-srxsme-11.2R2.4-domestic.tgz
-rw-r-----  1 root  wheel   4.9M Feb 11 17:12 ./cf/var/db/idpd/db/secdb_02.db
-rw-r-----  1 root  wheel   6.7M Feb 11 17:13 ./cf/var/db/idpd/db/secdb_03.db
-rw-r-----  1 root  wheel    64M Feb 11 17:13 ./cf/var/db/idpd/db/secdb_06.db
-rwxr-xr-x  1 admin  20    24M May 23 08:38 ./cf/var/db/idpd/nsm-download/SignatureUpdate.xml
-r-xr-xr-x  1 root  wheel   5.2M Jan  5 17:33 ./jail/html/dynamic-vpn/client/jam/InstallerComponentSRX.exe
-rw-r--r--  1 root  wheel   139M Sep  8  2011 ./jail/var/log/junos-srxsme-11.2R2.4-domestic.tgz
-rw-r-----  1 root  config    14M Feb  8 22:16 ./mfs/var/run/db/schema.db
-rw-r-----  1 root  wheel    10M Feb  8 22:19 ./mfs/var/sdb/log.0000000001
-r--r--r--  1 root  wheel   6.5M Jan  5 13:59 ./usr/lib/dd/libjkernel-dd.so
-r-xr-xr-x  1 root  wheel    13M Jan  5 15:39 ./usr/sbin/authd
-r-xr-xr-x  1 root  wheel   6.0M Jan  5 16:51 ./usr/sbin/chassisd
-r-xr-xr-x  1 root  wheel    27M Jan  5 13:05 ./usr/sbin/flowd_octeon
-r-xr-xr-x  1 root  wheel    34M Jan  5 13:05 ./usr/sbin/flowd_octeon_hm
-r-xr-xr-x  1 root  wheel   5.5M Jan  5 16:51 ./usr/sbin/kmd
-r-xr-xr-x  1 root  wheel    13M Jan  5 16:24 ./usr/sbin/rpd



2. Checkpoint Firewall gateway:


[Expert@CP]# find . -type f -size +50000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
./sysimg/CPwrapper/linux/CPEndpointSecurity/EndpointSecurityServer.bin: 145M
./sysimg/CPwrapper/linux/windows/SmartConsole.exe: 194M
./sysimg/CPwrapper/linux/CPrt/CPrt-R75.40-00.i386.rpm: 53M
./sysimg/CPwrapper/linux/CPportal/CPportal-R75.40-00.i386.rpm: 59M
./var/log/db: 336M
./var/log/upload/WebUpload.IjyBg6: 91M
./var/log/upload/Check_Point_R77.10_T151_upg_WEBUI_and_SmartUpdate.Gaia.tgz: 1.5G
./var/log/upgrade/RPMS/auto_hfs-0.2-cp990150005.i386.rpm: 59M
./var/log/upgrade/scripts/linux/CPcvpn/CPcvpn-R77-00.i386.rpm: 67M
./var/log/upgrade/scripts/linux/CPvpn/CPsuite-R77-00.i386.rpm: 504M
./var/log/upgrade/scripts/linux/CPuepm/CPuepm-R77-00.i386.rpm: 125M
./var/log/upgrade/scripts/linux/CPportal/CPportal-R77-00.i386.rpm: 62M
./var/log/upgrade/scripts/linux/windows/SmartConsole.exe: 302M
./var/log/upgrade/scripts/linux/CPrt/CPrt-R77-00.i386.rpm: 53M
./var/log/opt/CPsuite-R75.40/fw1/fw.log: 55M
./var/CPbackup/backups/backup_CP-M-DMZ.gi-de.com_9_7_2013_13_21.tgz: 59M
./var/opt/CPsuite-R75.40/fw1/conf/appfw/appfw_tables.sqlite: 130M
./sys/devices/pci0000:00/0000:00:02.0/resource2: 256M
./proc/kcore: 1015M

Tuesday, June 25, 2013

Use your ssh key to encrypt / decrypt files

Create a file:
echo 'This is a sekret' >/tmp/msg.txt


Export public key:
openssl rsa -in ~/private.pem -out /tmp/public.pub -outform PEM -pubout


Encrypt file with public key (anyone can have this key):
openssl rsautl -encrypt -inkey /tmp/public.pub -pubin -in /tmp/msg.txt -out /tmp/file.enc



Decrypt the file with private key (only you should have the private key):
openssl rsautl -decrypt -inkey ~/private.pem -in /tmp/file.enc -out /tmp/decrypted.txt



Check decoded message:
cat /tmp/decrypted.txt