Linux 全称: GNU/Linux
备份系统:
tar cvpzf backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys --exclude=/media /
还原系统:
# tar xvpfz backup.tar.gz -C /
然后新建之前没有备份的目录,如 mkdir proc 等。
配置软件源:
sudo vi /etc/apt/sources.list
#163源 deb http://mirrors.163.com/ubuntu/ precise main restricted deb-src http://mirrors.163.com/ubuntu/ precise main restricted deb http://mirrors.163.com/ubuntu/ precise-updates main restricted deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted deb http://mirrors.163.com/ubuntu/ precise universe deb-src http://mirrors.163.com/ubuntu/ precise universe deb http://mirrors.163.com/ubuntu/ precise-updates universe deb-src http://mirrors.163.com/ubuntu/ precise-updates universe deb http://mirrors.163.com/ubuntu/ precise multiverse deb-src http://mirrors.163.com/ubuntu/ precise multiverse deb http://mirrors.163.com/ubuntu/ precise-updates multiverse deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ precise-security main restricted deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted deb http://mirrors.163.com/ubuntu/ precise-security universe deb-src http://mirrors.163.com/ubuntu/ precise-security universe deb http://mirrors.163.com/ubuntu/ precise-security multiverse deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse deb http://extras.ubuntu.com/ubuntu precise main deb-src http://extras.ubuntu.com/ubuntu precise main #sohu源 deb http://mirrors.sohu.com/ubuntu/ precise main restricted deb-src http://mirrors.sohu.com/ubuntu/ precise main restricted deb http://mirrors.sohu.com/ubuntu/ precise-updates main restricted deb-src http://mirrors.sohu.com/ubuntu/ precise-updates main restricted deb http://mirrors.sohu.com/ubuntu/ precise universe deb-src http://mirrors.sohu.com/ubuntu/ precise universe deb http://mirrors.sohu.com/ubuntu/ precise-updates universe deb-src http://mirrors.sohu.com/ubuntu/ precise-updates universe deb http://mirrors.sohu.com/ubuntu/ precise multiverse deb-src http://mirrors.sohu.com/ubuntu/ precise multiverse deb http://mirrors.sohu.com/ubuntu/ precise-updates multiverse deb-src http://mirrors.sohu.com/ubuntu/ precise-updates multiverse deb http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://mirrors.sohu.com/ubuntu/ precise-backports main restricted universe multiverse deb http://mirrors.sohu.com/ubuntu/ precise-security main restricted deb-src http://mirrors.sohu.com/ubuntu/ precise-security main restricted deb http://mirrors.sohu.com/ubuntu/ precise-security universe deb-src http://mirrors.sohu.com/ubuntu/ precise-security universe deb http://mirrors.sohu.com/ubuntu/ precise-security multiverse deb-src http://mirrors.sohu.com/ubuntu/ precise-security multiverse deb http://extras.ubuntu.com/ubuntu precise main deb-src http://extras.ubuntu.com/ubuntu precise main #ubuntu.cn99.com源(推荐): deb http://ubuntu.cn99.com/ubuntu/ precise main restricted universe multiverse deb http://ubuntu.cn99.com/ubuntu/ precise-updates main restricted universe multiverse deb http://ubuntu.cn99.com/ubuntu/ precise-security main restricted universe multiverse deb http://ubuntu.cn99.com/ubuntu/ precise-backports main restricted universe multiverse deb http://ubuntu.cn99.com/ubuntu-cn/ precise main restricted universe multiverse #中国科技大学 deb http://debian.ustc.edu.cn/ubuntu/ precise main restricted universe multiverse deb http://debian.ustc.edu.cn/ubuntu/ precise-backports restricted universe multiverse deb http://debian.ustc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse deb http://debian.ustc.edu.cn/ubuntu/ precise-security main restricted universe multiverse deb http://debian.ustc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse deb-src http://debian.ustc.edu.cn/ubuntu/ precise main restricted universe multiverse deb-src http://debian.ustc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse deb-src http://debian.ustc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse deb-src http://debian.ustc.edu.cn/ubuntu/ precise-security main restricted universe multiverse deb-src http://debian.ustc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse #北京理工大学 deb http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe deb http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe deb http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe deb http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe deb http://mirror.bjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe
更新软件源:sudo apt-get update
linux中的root目录下的几个文件及其功能
linux中的root目录下的几个文件各是,anaconda-ks.cfg,install.log,install.log.syslog.这些文件分别的作用:
1.anaconda-ks.cfg是你安装本系统时自动生成的一个配置文件,可以用在其它安装过程中。
2.install.log是安装的日志文件,一般是安装的每一个软件包。
3.install.log.syslog是安装时对用户及用户组的配置,如创建用户、用户组等。
修改计算机名(可影响到命令提示符):
hostname V370
解决PDF中文问题:
用默认的 Document Viewer 打开带中文(文字版)PDF时,中文不显示:
1、sudo apt-get install xpdf-chinese-simplified xpdf-chinese-traditional
2、sudo apt-get install poppler-utils poppler-data
3、sudo vim /etc/fonts/conf.d/49-sansserif.conf
把 <edit name="family" mode="append_last"> 下面的一行修改为 <string>WenQuanYi Micro Hei</string>
WenQuanYi Micro Hei的意思就是:中文字体“文泉驿微米黑”。
Anjuta 编译C++项目报错 You must have `glib' installed.
解决方法:sudo apt-get install libglib2.0-dev pkg-config
再报:exec:g++: not found
解决方法:sudo apt-get install g++
执行shell有一些快捷键:
Ctrl + C:终止命令的执行
Ctrl + Z:暂停命令的执行
Ctrl + U:清空当前命令,即重新输入命令
Ctrl + L:相当于clear
type 命令名:查看命令类型
man 命令名:查看命令的帮助文档(非Shell内建命令)
help 命令名:查看命令帮助助文档(Shell内建命令)
which 命令名:查看命令的路径
alias ll='ls -alF'
unalias ll
history [-c | n]
!6
/etc/bash.bashrc 系统环境设定文件,设定一些环境变量和命令行提示符
/etc/profile 系统的启动脚本文件,也是对系统环境进行了设定
~/.bashrc 当前登录用户的宿主目录下的配置文件,对用户个性化环境进行单独设定,设定了用户的别名等
~/.profile 当前登录用户的初始化文件
name="ubuntu"
echo $name 注:echo "$name" 结果一样,但 echo '$name' 却是输出 $name 了
export name="ubuntu" 非登录shell可用
unset name
PATH=$PATH:. 添加当前路径为环境变量
PS1="[\u@\h:\w\$]" 改变命令提示符
\u:用户名 \h:主机名 \w:当前工作目录绝对路径 \$:提示符,普通用户$,超级用户#
$0:表示执行的Shell脚本名
$1 ~ $9:表示传给程序的参数
${10}~${n}:同上,只是如果位置数大于9的话,应用用{}将数字括起
$#:位置变量的个数
$*:所有的位置变量
$@:如果不加"",则与$*相同,如果为"$@",则表示每个位置变量的值
$$:表示当前Shell的PID的值
$?:最近一个执行过的命令的退出值
示例:test.sh
echo $1 $2
echo $0
echo $#
echo $@
echo $$
echo $?
命令执行顺序:
&&:执行成功后,才能执行下一个
||:执行失败后,才能执行下一个
;:连续执行一组命令
如:
mv /home/test /home/bak && rm-rf /home/test
grep "user1" /etc/passwd || useradd -d /home/user1 -m user1
操作一个命名的结果:
ls -l `which mkdir`
I/O重定向:
0:标准输入 <
1:标准输出 > >>:追加式
2:错误输出 2>
管道:
将一个命令的输出作为另一个命令的输入:
cat /etc/passwd | wc -l
一般可以在shell第一行写上:
#!/bin/bash
表示此脚本使用哪个shell对其进行解释执行,#:注释
读取用户输入:
read [-p "字符串"] 变量名
read -p "Please input your name:" username
read username
类型声明:默认为string
declare -i one=1
declare -i two=2
declare -i three=$one+$two
判断条件结果为真时返回0,否则为1:
test -e /etc/code1/ ;echo $?
条件语句:if 与 [ ,条件与 [ ] 之间必须要有空格
if [ 条件 ]; then
命令
fi
或:
if [ 条件 ]
then
命令
fi
或:
if [ 条件 ]; then
命令
elif [ 条件 ]; then
命令
else
命令
fi
case命令:
case 变量值 in
值1)
命令
;;
值2)
命令
;;
*)
命令
;;
esac
循环:
for 变量 in 变量1 变量2 变量3
do
命令
done
while [ 条件 ]
do
命令
done
until [ 条件 ]
do
命令
done
脚本调试:
bash [-xvn] 脚本名
-n:不执行脚本,只检查语法错误
-x:可以将所有脚本内容在执行时显示出来,方便调试
ubuntu默认不能从root登录桌面:
1、vim /etc/lightdm/lightdm.conf
加上:
greeter-show-manual-login=true
allow-guest=false
2、sudo passwd root 设置密码
将家目录下的中文目录改为英文:
1、先删除这些中文目录
2、mkdir Desktop Download
3、vim ~/.config/usr-dir.dirs 修改即可
4、重启
ubuntu下的firefox下载框为空白的解决方法:
vim /etc/default/locale 把 LANG="zh_CN.UTF-8" 改为 LANG="zh_CN"
主要是因为在安装系统的时候就安装好了中文语言包,如果是安装好系统之后再更新中文语言包,貌似可以避免该问题。
wine安装.msi文件:
wine msiexec /i python-2.7.1.msi
安装 RTX的方法:
1、apt-get install wine1.4-i386 (如果系统是64位,也需要安装32位的wine)
wget http://www.kegel.com/wine/winetricks
sudo apt-get install cabextract
sh winetricks msxml3 msxml6 gdiplus riched20
riched30 ie6 vcrun6 vcrun2005sp1 flash win2k (最好分开安装)
wget http://www.beyondlinux.com/files/pub/wine/install_flash_player_ax.exe
wine msiexec /i msxml3.msi
wine ie60.exe
wine install_flash_player_ax.exe
REGEDIT4 [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes] "Arial"="simsun" "Arial CE,238"="simsun" "Arial CYR,204"="simsun" "Arial Greek,161"="simsun" "Arial TUR,162"="simsun" "Courier New"="simsun" "Courier New CE,238"="simsun" "Courier New CYR,204"="simsun" "Courier New Greek,161"="simsun" "Courier New TUR,162"="simsun" "FixedSys"="simsun" "Helv"="simsun" "Helvetica"="simsun" "MS Sans Serif"="simsun" "MS Shell Dlg"="simsun" "MS Shell Dlg 2"="simsun" "System"="simsun" "Tahoma"="simsun" "Times"="simsun" "Times New Roman CE,238"="simsun" "Times New Roman CYR,204"="simsun" "Times New Roman Greek,161"="simsun" "Times New Roman TUR,162"="simsun" "Tms Rmn"="simsun"
然后通过 regedit rtx.reg 执行
通过windows搜索 Configure Wine 程序,找到"函数库”->在“新增函数库顶替”中,输入“oleaut32.dll”,再点击“添加”->“应用”->“确定”。
4、解决自动离开状态:
在登录RTX后在“个人设置”里的“回复设置中”把“自动状态转换”的勾去掉。
为 firefox 安装 flash 播放插件:
1、从官网下载 flashplayer 。
2、tar -zxvf install_flash_player_11_linux.x86_64.tar.gz
3、将libflashplayer.so拷贝到Firefox的Plugin目录:cp libflashplayer.so /usr/lib/mozilla/plugins/
4、将usr目录下的所有文档拷贝到系统的/usr目录下:cp -r ./usr/* /usr/
5、重启 firefox