0. Linux Command
# grepe.g. grep -R abc /etc/network/ #-R ,"chmod -R"
[other param] grep -l -n -v
# find
e.g. find -type f -exec grep aaaa {} \;
[other param] find -name -size -perm -type -ctime -a -o -exec -ok
# input/output redirect
command > a.txt command >> a.txt
command 2> a.txt command 2>> a.txt
command > a.txt 2>&1 command &> a.txt
# tar
e.g. tar cvf 123.tar /etc/network/
tar xvf 123.tar
tar cvfz 123.tar.gz /etc/network/
tar xvfz 123.tar.gz
tar cvfj 123.tar.bzip /etc/network/
tar xvfj 123.tar.bzip
# "tar rvf 123.tar.gz/123.tar.bzip" is not invalid
tar rvf 123.tar /etc/abc/ /etc/we/ #append tar
tar tvf 123.tar #review tar
tar tvf 123.tar.gz #review zip
tar tvf 123.tar.bzip #review bzip
man tar
c [create]
x [extract]
v [verbose]
f [file]
z [gzip]
j [bzip2]
1. 軟件安裝工具apt
在利用apt工具安裝軟件時,若安裝軟件包出問題,則可以嘗試一下更新軟件包列表和軟件更新,方法如下:
# apt-get update //獲取最新的軟件包列表# apt-get upgrade //軟件更新
如果更新失敗,則可以進一步嘗試更新apt源,即更新 /etc/apt/sources.list
比如,在Ubuntu 12.10版本可以使用如下源列表:
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-security main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-security main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
2. 利用apt工具安裝常用軟件
1)ssh的安裝和啓動# apt-cache search sshd
# apt-get install openssh-server
# /etc/init.d/ssh start
2)其他軟件的安裝類似,比如samba、svn等
# apt-get install samba
# apt-get install subversion
3. samba
1) 修改 /etc/samba/ 目錄下的 smb.conf ,增加如下配置[username]
path = /home/username
available = yes
browsealbe = yes
public = yes
writable = yes
valid users = username
2)添加samba用戶名和密碼
# useradd username (一般第一步中設置的users爲已經存在的用戶,因此,username一般已經存在,無需進行useradd操作)
# smbpasswd -a username
3)啓動samba服務
# service smbd start
重啓samba服務
# service smbd restart
4)windows中直接從工具中映射網絡驅動器即可
映射文件夾設置:\\虛擬機IP\samba用戶名(舉例:\\192.168.5.170\username)
補充:
① 檢測samba配置smb.conf的正確性的命令 testparm
② 查看samba(smb.conf)所有設定值(包括smb.conf中沒有設定的默認值),則可以使用 testparm -v
4. tftp
tftp -r abc.txt -g 192.168.0.2tftp -r abc.txt -p 192.168.0.2
5. svn
svn checkout https://192.168.10.165/svn/GR-3000-V1/codesvn add file
svn commit -m "修改說明" file
svn update [ -r version ]
svn status
svn diff