Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, July 13, 2016

GITHUB(simple)


Introduction of using GITHUB.
This are some of the simple setting or tutorial of using github. I will teach you the most simple command.

I will teach you: 
Push file in, add/ delete single folder, add multiply subdirectory.

I had written a slide, please take a took at it: GITHUB_SIMPLE


1)Create a Project (we called this a repositories )
we have to create an github account first before using this.
Go to your GITHUB webpage and create a new repositories .
We can create file on GITHUB page, but i reccomend used a utiity, which I'll introuce next.

2) Utility Introduce
WHY?????
It'll be really convenient when using a utility. You doesn't have to open web browser and upload your file or create folder. Most of the people coding ir creat a project on their own local laptop or PC. We can just sync from our local to the server by typing a few comment, then that's done.

3) Types of utility
There are three type of platfrom on GITHUB, you cn used either of this.

Window 
Window Desktop Source Tree

Linux
debian/ubuntu:  apt-get install git-core
Fedora/Redhat: yum install git-core

MAC: brew install git

NOTE: In my note I'll just used linux as an example,

4) Set up

your username:
#git config --global user.name "YOUR NAME"
your email:
#git config --global user.email "YOUR EMAIL ADDRESS"

your configure
#git config user.name

5)Clone your repository into your local [command: git clone]

sample: git clone  http//github.com/xxxxx/ooooo. 

 X: your username  
0:your repository name
# under Linux utility, create a directory 
mkdir GITHUB 
# clone repository from server to local and download it. Test is repository
git clone  http//github.com/chenchih/test 

6) Commit/Git push (add a new file) add a file in your local disk. Before Git Push we have to commit first. Every time you modify a file we have to commit; commit is to write description on what you modify to let you know

#go to test and create a file
touch 123456.txt
git commit -m "add file "
git push 

7)Add /delete folder[single]

Add folder
#create new folder 
mkdir testfolder 
#also create folder in gitserver 
add 'testfolder' 
#commit it 
git commit -am "Add testfolder" 
git push 
delete Folder
#delete new folder 
rm -rf testfolder 
#also delete folder in gitserver 
git rm -rf 'testfolder' 
#commit it 
git commit -m "Removed folder from repository"
git push 


8)add entire directory

# go into folder directory 
cd testfolder 
git add *
git commit -m "with the message"
git push

9) other command

Fork: when you coworj with other people, you go to their githib, and press fork
diff: is when you modify the file, you can see what's the different between previous

Reference: 
Setting config: 
https://help.github.com/articles/remembering-your-github-username-or-email/
https://help.github.com/articles/set-up-git/

Chinese tutorial 
http://gogojimmy.net/2012/02/29/git-scenario/

Source tree tutoria Chinese
https://superbil.github.io/slide/sourcetree/#sec-1

Monday, August 24, 2015

Linux command (system, advance)

Linux command (system, advance)

Disk/ storage part:

dd command: used to back up disk or partition, most often used for backup file, like ghost
dd if=/'name of the iso file name[to]' of='/backup partition[from]'
ex: dd if =/filename.iso of /dev/sdd
 or
dd if =/dev/sfa of=/dev/sdd

df command: see the size of the hdd 
#df -h
#df


extract and compress file:
extract file
tar -xzf zzz.tar.gz

compress file 'file '
tar -tzvf compressed.tar.gz


Wednesday, February 25, 2015

RAMDISK

linux command (network)

Add Network (network command)

(1)add interface
[root@server ~]#cd /etc/sysconfig/network-scripts
[root@server ~]#vi ifcfg-eth0
DEVICE="eth2"
BOOTPROTO="dhcp"
HWADDR="00:02:C9:27:59:FE"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
IPV6INIT="no"

(2)If set ip, will not active after reboot.
When we set some ip address, after reboot or services restart will not active. This means that we have to kill the temporary store ip address. This often occur when we had a dhcp Ip address, then we wants to change to a static. But i also found out that if i wants to change a new network card, will also happen, the ip will not change.

Please set ip address first, then clear this.
[root@server ~]#cd /etc/udev/rules.d
[root@server ~]#rm 70-persistent-net.rules

(3) show ip address
[root@server ~]#ifconfig

(4) show ip interface
[root@server ~]#ip a












(5) ethtool - query or control network driver and hardware settings
ethtool ethernet interface
#ethtool eth0
This will let you see your link rate, support wake on lan, lan detect or not, and so on.

(6) enable your interface
#ifdown eth0
#ifup eth0

(7) ping
ping ip address
ping -c 1 ipaddress  ==>ping one second

(8) Search dhcp client ip address, or bmc ip address
cat /var/log/messages | grep BMC MAC address
example: cat /var/log/messages | grep  xx:xx:xx:xx:xx:xx

(9) changed Server name 
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=putXX




Linux command

PART 1 SIMPLE COMMAND

(1) list directory contents (refer to window dir)
command: ls
Description /purpose: Print or list the file or folder in this directory

[root@server ~]# ls

command: ll
Description /purpose:  Print or list the file or folder in this directory, but this will show information.
[root@server ~]# ll













(2) print name of current/working directory (pwd)
Description /purpose: show which directory or path you are in right now.
[root@server ~]# pwd
/root

(3) copy (cp)
Description /purpose: copy file or create backup

#cp dhcp.conf dhcp.conf.bk

(4)move or rename file ( mv)
Description /purpose:  rename a file name, or generate a file
#mv old.txt new.txt

(5) cat
Description /purpose: read a file name
cat 123.txt

(6)modify text (vi or vim)
Description /purpose: to modify some file
vi is modify, and vim is improve, which will have show in different color.
Some variable need to used

vi











vim

:q! ==>exit without saving
:w! ==>save
:wq!==>save and quit
:x!==>save and exit
? or / ==>search

Note: For more information, please refer shell script



(7) touch
Description /purpose:to generate a file. Different between vi is it don't have to save to generate a file. It will generate a file if input touch command.
touch aaa.txt

(8)tail
Description /purpose: output the last part of files
will print last 10 line 
#tail /var/log/message

 output appended data as the file grows. 
#tail -f

difference from cat versus tail
tail is different from cat, is cat will read all the file once, but tail will not. For example if you have a log file, you cat log file, it will read all the line from first line to last line. But tail will read last line, and if the file still have message, it will also show.

 (9) clear
Description /purpose:clear the terminal screen
#clear


PART 2 Intermediate (common used and file related)

1. extract file
tar -zxvf extract.tar.gz
#tar -zxvf filename.tar.gz 

2. compress file
tar -tzvf compressed.tar.gz
tar -zcvf filnename.tar.gz 'folder destination/'
#tar -zcvf filnename.tar.gz folder /test

3. mount
what is mount?
A mount is where I wants to mount a directory into one folder. Mount this command can used for many ways.
Basely mount this command is like if i have a directory names test, if i wants to mount a directory "dhcp" into test this directory. Directory test all the data will be used by dhcp this directory. In other word mean all test directory will be gone, will only appear dhcp data. If you umount it, it will be appear.

Mount this command can be used for:

Mount for folder to folder which is like shortcut
# mount --bind /etc/dhcp /dhcpfile_test











Mount for usb drive to /mnt directory 




Mount for network 



4 link or shortcut
command "ln -s"
ln -s orginally folder or file shortcut
# ln -s /etc/dhcp/ /dhcpfile











5 set date
date MMddhhmmyyyy




Friday, December 12, 2014

Set up dhcp linux


Set up dhcp under linux:


What is a dhcp server 
I will used my paraphrase in my own word. There are many information that you can get from internet.

Basely a dhcp server is a dynamic ip(internet protocol)  address that will assign to the host. Everyone today used internet, we need to connect lan cable to a hub, switch or etc. These hub switch might have a dhcp server in the backbone or in front of them, else it will not be able to assign ip to the host.

A ip address will have a unique ip address, in other word no one is going to have a same ip address.
So the fundamental concept of a dhcp is like this:
1. we set up a dhcp server( linux or window]
2. we prepare a switch , or a hub, and connected to dhcp server.
3 Right now if any host is being connected to the hub or switch, will have a dynamic ip.

I will teach you how to mange an effective ip address for user to used. There are two difference ways of mange dhcp. One is to set a static ip address by an interface mac address, and two is by rang an ip address.


Set up particular pc ip address into static ip. 
If you have many host or more than 10 HOST PC or Server, it is hard to control or manage a dhcp. So we will needed to add a particular interface mac and set a static ip, this will be more easier to know which pc is which.

host ASER_HOSTA {
  hardware ethernet AB:AA:BB:CC:DD:EE;
  fixed-address 192.168.2.100;
}

host ASUS_HOSTB {
  hardware ethernet CD:AA:BB:CC:DD:EE;
  fixed-address 192.168.2.101;
}


Set up a dhcp range
If you need to set up a dhcp server, you can add or not add a rang. I will prefer you add a rang between 101~200, this mean ip will be between 101 and 200. Again this will be easier to manage you dhcp server.

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.101 192.168.1.200;
 option subnet-mask 255.255.255.0;
}


Set up a dhcpv6 range

default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet6 2001:db8:0:1::/64
{
#Range for clients
range6 2001:db8:0:1::129 2001:db8:0:1::254;
}