Thursday, October 29, 2015

Detect, mount, format devices


Detect devices:
  1. lsblk : prints all block devices (except RAM disks) in a tree-like format by dafault. More clear than comman "mount"
  2. mount -l \ -a (man mount for more details)
  3. file : determine file type
  4. df -h
  5. lsusb
  6. sudo fdisk -l 

Mount devices:
  1. mount -t type device dir  
    • we can find some device in /dev/disk/.......
    • usually linux can automatically detect file system type, so we don't need "-t"
    • example: mount /dev/sdf4  /media/usb
    • if path "/media/sdf4" is not exsited, we need create a new directory to mount device


Umount devices :
  1. umount device

Sunday, October 25, 2015

Thursday, October 22, 2015

Configure local ubuntu to be accessed remotely

LAN

1, configure ssh.

  • we need ssh server to share our machine with others. ssh is usually installed in linux distributions, however , ssh server is not installed. so first , we need to install a ssh server.  "sudo apt-get install openssh-server"  
  • start ssh server with command "sudo /etc/init.d/ssh start" check if it's started using command "ps -e  | grep sshd"
  • set the port which ssh server will listen for. "vim /etc/ssh/sshd_config" there is a line starting with "Port port_number", we can change this port_number to the port we want to listen for.

2, configure firewall: iptables

  • add some rules to accept packages from other machine. "sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT " 
  • save set (method 1)(make iptables rules persistent): 
    • "iptables-save > /etc/iptables.rules" : save set in file iptables.rules
    • edit a bash file in /etc/network/if-pre-up.d/iptables.sh                                   
      • #! /bin/bash
      • iptables-restore < /etc/iptables.rules"
  • save rules permant (method 2) 
    • sudo apt-get install iptables-persistent
    • service iptables-persistent start

WAN


  1. if your server is in a LAN, and you want to access a server in the LAN from outside, then find the router of the LAN, and configure the router. Set the router to forward to forward connections to port 4015(set above) to your internal IP address.

Wednesday, October 21, 2015

Commands Learned


  1. less : see text file. one pape 
  2. file : examine file type
  3. standard input / standard output / Pipelines
  4. Permissions
  5. Job control : ps/kill/jobs/bg/fg

一些重要文件的位置


  1. iptables中各个协议及其对应编号: /etc/protocol
  2. 网络服务及其对应编号 : /etc/services
  3.  

Tuesday, October 20, 2015

Shell scripts

linux command

learn shell

alias Create a command for a linux executable file

edit the file ".bashrc" , add the below line at the bottom of the file.

"alias eclipse=/opt/eclipse/eclipse" and Do "source ~/.bashrc" to be able to use alias as a command.

**this is way like "define #"in the C/C++, when you type "eclipse",it will be replaced with the right hand side of the alias definition, which here is the full path to the executable.

Understanding more about /etc/profile and /etc/bashrc

examples

alias gquit="gnome-session-quit" (we can use a short word to replace the long command in this way)

Sunday, October 18, 2015

Saturday, October 17, 2015

tools in linux

  1. setup bootable usb : unetbootin (sudo /usr/bin/unetbootin)

Hack Windows passward

  1. Bootablelinux USB && boot some flavor of linux live USB
  2. Navigate to system32
  3. Rename Magnify.exe : find magnify.exe, and rename it to magnify.old
  4. Rename cmd.exe : find cmd.exe, and rename it to magnify.exe
  5. shutdown ubuntu and reboot Windows
  6. Get CMD Prompt Modify Accounts : Ease of Access : click "magnifier" and hit "apply"
  7. get an cmd seesion, type "net user" to get a list of accounts.                           My Options:                                                                                                        Change PWD : "net user username new_password"                                          Add an account : net user username password /add                                         Admin that : net localgroup administrators username /add                             Deltet that : net user username /delete                                                              net user systax reference                                                                          
  8. Reboot linux and Fix magnify.exe : repeat step 1 && 2 && 3, then rename magnify.exe to cmd.exe , rename magnify.old to magnify.exe


reference : clever method

Friday, October 16, 2015

Ucore Course tools

Spending two months finishing Ucore Class and Ucore labs.
Then I will take MIT OS class. Meantime hoping to do something about sensor and hardware.

install grunt in ubuntu 14.04  : it's wrong according to the official website.

Git 


Thursday, October 15, 2015

Apache2

learn about how to configure with apache2 and learn about apache.

References:
Apache2 Ubuntu Documentation
Apache2 Documentation : contains in depth information on Apache2 configuration directives. Also, see the apache2 doc package for the official Apache2 docs.
Mod SSL Documentation : site for more related documentation
Apache Cookbook




Tuesday, October 13, 2015

Linux boot


Linux File System Standard

File System Standard

Linux Online Emulator

一个叫Fabrice Bellard的工程师使用 JavaScript 在浏览器上模拟出了一个 Linux 系统。没有图形化界面,完全使用命令行的方式与之互动。Linux操作系统内核版本为2.6.20。具体使用过程中可以参考jslinux:的


FAQ:http://bellard.org/jslinux/faq.html 

技术说明:http://bellard.org/jslinux/tech.html