Linux Starter

来源:互联网 发布:网络销售的职位描述 编辑:程序博客网 时间:2024/05/17 06:37

Linux Startup

Useful hotkey

on terminal

ctrl + w: delete current word
ctrl + u: delete to head
ctrl + L: clear
Shift + Ctrl + C: copy
Shift + Ctrl + V: paste
CTRL + Z: put current job background
ctrl + alt + t: open a new terminal

Share files from windows

mount on terminal

sudo mount -t cifs -o username=xx,password=xx //192.168.0.xx/SharedFileName /home/newFileName

Attention. The username and password are created by Windows. Use ‘Local users and groups’ to manage your accounts.

mount when boot

sudo gedit /etc/fstab 

add at the last line

/192.168.0.xx/SharedFileName /home/newFileName cifs defaults,auto,username=xx,password=xx

back to terminal, apply changes or umount file

# apply changessudo mount -a# umount filesudo umount file_path

Config Shadowsocks

Follow thiswebsite

or thiswebsite
This two webs already died.
Use Shadowsocks Qt, config chromium with SwichyOmega, which can transfer HTTP into SOCKS5.

code below to use agent in Terminal

# startup global agencyexport http_proxy=http://127.0.0.1:1080export https_proxy=http://127.0.0.1:1080# cancel unset http_proxyunset https_proxy

Accelerate apt-get

Install apt-fast

for ubuntu 14.04&higher

sudo add-apt-repository ppa:saiarcot895/myppasudo apt-get updatesudo apt-get install apt-fast# config the app, default setting is ok

add mirrors, you can find mirrors here

sudo gedit /etc/apt-fast.conf # add MIRRORS=('http://ubuntu.uestc.edu.cn/ubuntu/,http://mirrors.aliyun.com/ubuntu/,http://ftp.sjtu.edu.cn/ubuntu/,ftp://ftp.sjtu.edu.cn/ubuntu/,http://mirrors.tuna.tsinghua.edu.cn/ubuntu/,rsync://mirrors.tuna.tsinghua.edu.cn/ubuntu/')# orMIRRORS=('http://mirror.lzu.edu.cn/ubuntu/,ftp://mirror.lzu.edu.cn/ubuntu/,http://mirrors.aliyun.com/ubuntu/,http://ubuntu.cn99.com/ubuntu/,http://ftp.sjtu.edu.cn/ubuntu/,ftp://ftp.sjtu.edu.cn/ubuntu/,http://mirror.neu.edu.cn/ubuntu/,http://mirrors.163.com/ubuntu/,http://mirrors.sohu.com/ubuntu/,ftp://mirrors.sohu.com/ubuntu/,http://mirrors.tuna.tsinghua.edu.cn/ubuntu/,http://mirrors.ustc.edu.cn/ubuntu/,ftp://mirrors.ustc.edu.cn/ubuntu/,http://mirrors.yun-idc.com/ubuntu/,ftp://mirrors.yun-idc.com/ubuntu/,http://mirrors.zju.edu.cn/ubuntu/,http://mirrors.skyshe.cn/ubuntu/,http://mirror.bjtu.edu.cn/ubuntu/,ftp://mirror.bjtu.edu.cn/ubuntu/,http://mirrors.cug.edu.cn/ubuntu/,http://mirrors.hust.edu.cn/ubuntu/,http://mirrors.hustunique.com/ubuntu/,http://mirrors.oss.org.cn/ubuntu/,http://ubuntu.cnssuestc.org/ubuntu/,http://ubuntu.dormforce.net/ubuntu/,http://ubuntu.uestc.edu.cn/ubuntu/,http://free.nchc.org.tw/ubuntu/,ftp://free.nchc.org.tw/ubuntu,http://tw.archive.ubuntu.com/ubuntu/,ftp://tw.archive.ubuntu.com/ubuntu/,http://ftp.ubuntu-tw.net/mirror/ubuntu/,ftp://ftp.ubuntu-tw.net/mirror/ubuntu/,http://ftp.nsysu.edu.tw/Ubuntu/ubuntu/,http://ftp.stust.edu.tw/pub/Linux/ubuntu/,ftp://ftp.stust.edu.tw/pub/Linux/ubuntu/,http://ftp.tc.edu.tw/Linux/ubuntu/,ftp://ftp.tc.edu.tw/Linux/ubuntu/,http://ftp.tku.edu.tw/ubuntu/,ftp://ftp.tku.edu.tw/ubuntu/,http://ftp.yzu.edu.tw/ubuntu/,ftp://ftp.yzu.edu.tw/ubuntu/,http://ftp.ntou.edu.tw/ubuntu/,ftp://ftp.ntou.edu.tw/ubuntu/,http://ubuntu.cs.nctu.edu.tw/ubuntu/,ftp://ubuntu.cs.nctu.edu.tw/ubuntu/,http://ubuntu.stu.edu.tw/ubuntu/,ftp://ubuntu.stu.edu.tw/ubuntu/,http://mirror01.idc.hinet.net/ubuntu/,http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/,ftp://ftp.cuhk.edu.hk/pub/Linux/ubuntu/,http://ubuntu.01link.hk/,http://ubuntu.uhost.hk/')# back to terminalsudo apt-fast update

Accelerate Pip Install

gedit ~/.pip/pip.conf# add lines[global] index-url = http://pypi.douban.com/simple trusted-host = pypi.douban.comdisable-pip-version-check = truetimeout = 120# if cannot find ~/.pip/pip.conf, just usesudo pip install appname  --trusted-host pypi.douban.com -i http://pypi.douban.com/simple

Attention. Do not use sudo while pip install, otherwise the system will try to find configuration under root directory.

Use find to delete specified files

find -name "*zxz*" -exec rm {} \;

Delete all files contain “zxz”, use find -exec or find -ok (safer)
Attention. There must be a space between rm and {}, {} and \;

Auto complete

sudo apt-get install bash-completionsource /etc/bash_completion

Install gcc with different versions

sudo apt-get install gcc-4.5 gcc-4.5-multilib g++-4.5 g++-4.5-multilib# the last number is the prioritysudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.5 40# swith version by commond belowsudo update-alternatives --config gcc# delete the source if type wrongsudo update-alternatives --remove gcc /usr/bin/gcc-4.5
0 0
原创粉丝点击