查找文件大小大于100M的文件
find ./ -size +100000k -print
如我们可以指定fcitx 安装到 /opt/fcitx 目录中;
[root@localhost fcitx]#./configure --prefix=/opt/fcitx
如果我们不需要fcitx 时,可以直接删除 /opt/fcitx 目录;
所以我们举这个例子中,fcitx如果定制安装到 /opt/fcitx目录中,完整的安装方法应该是:
root@localhost fcitx]# tar jxvf fcitx-3.2-050827.tar.bz2
[root@localhost fcitx]#cd fcitx
[root@localhost fcitx]# ./configure --prefix=/opt/fcitx
[root@localhost fcitx]# make
[root@localhost fcitx]# make install
查看端口:lsof -i:8080
查找:find -name *.* -print
#find /目录 -type d -name conf
find / -type d -name huanghuahe
ps -auxw|grep 5704
软连接:
/jre/lib/i386/jli/下找到libjli.so,给他在/usr/lib/里做一个软连接
格式:ln [参数] <源文件名> <链接文件名>
参 数:
-b或--backup 删除,覆盖目标文件之前的备份。
-d或-F或--directory 建立目录的硬连接。
-f或--force 强行建立文件或目录的连接,不论文件或目录是否存在。
-i或--interactive 覆盖既有文件之前先询问用户。
-n或--no-dereference 把符号连接的目的目录视为一般文件。
-s或--symbolic 对源文件建立符号连接,而非硬连接。
-S<字尾备份字符串>或--suffix=<字尾备份字符串> 用"-b"参数备份目标文件
apache2
先卸载了
首先sudo apt-get remove apache2
再sudo apt-get autoremove
问题已经解决了,先卸载了,然后命令行安装
sudo aptitude -r install apache2
这样安装的组件比较完整,也把apache2-mpm-worker装上就可以启动了
看来还是命令行稳妥啊
启动apache2
sudo /etc/init.d/apache2 start
Linux压缩文件的读取
· *.Z compress 程序压缩的档案;
· *.bz2 bzip2 程序压缩的档案;
· *.gz gzip 程序压缩的档案;
· *.tar tar 程序打包的数据,并没有压缩过;
· *.tar.gz tar 程序打包的档案,其中并且经过 gzip 的压缩!
· *.zip zip 程序压缩文件
· *.rar rar 程序压缩文件
Compress压缩文件
[root@test /root]# cp /etc/man.config /root
[root@test /root]# compress man.config //压缩man.config这个文件
[root@test /root]# compress -d man.config.Z //-d 解压缩这个文件
[root@test /root]# uncompress man.config.Z //解压缩这个文件
当你以 compress 压缩之后,如果没有下达其它的参数,那么原本的档案就会被后来的 *.Z 所取代!
Gzip压缩文件和zcat
[root@test /root]# gzip [-d#] filename <==压缩与解压缩
[root@test /root]# zcat filename.gz <==读取压缩档内容
参数说明:
-d :解压缩的参数!
-r :递归处理,将指定目录下的所有文件及子目录一并处理
-# :压缩等级, 1 最不好, 9 最好, 6 是默认值!
[root@test /root]# gzip man.config //会产生 man.config.gz 这个档案
[root@test /root]# zcat man.config.gz //会读取出 man.config 的内容
[root@test /root]# gzip -d man.config.gz
[root@test /root]# gunzip man.config.gz
解压缩,产生 man.config 这个档案
[root@test /root]# gzip -9 man.config //以最大压缩比压缩 testing 这个档案!
[root@test /root]# gzip -r filename.gz file1 file2 file3 /usr/work/school
//file1、file2、 file3、以及 /usr/work/school 目录的内容(假设这个目录存在)压缩起来,然后放入 filename.bz2 文件中
Bzip2压缩文件和bzcat
[root@test /root]# bzip2 [-dz] filename <==压缩解压缩指令
[root@test /root]# bzcat filename.bz2 <==读取压缩文件内容指令
参数说明:
-d :解压缩的意思!
-z :压缩的意思!
范例:
同样的,我们以刚刚拷贝过来的 /root/man.config 这个档案为例
[root@test /root]# bzip2 –z man.config
[root@test /root]# bzcat man.config.bz2
[root@test /root]# bzip2 –d man.config.bz2
[root@test /root]# bunzip2 man.config.bz2
[root@test /root]# bzip2 filename.bz2 file1 file2 file3 /usr/work/school
//file1、file2、 file3、以及 /usr/work/school 目录的内容(假设这个目录存在)压缩起来,然后放入 filename.bz2 文件中
Tar压缩文件
[root@test /root]# tar [-zxcvfpP] filename
[root@test /root]# tar -N 'yyyy/mm/dd' /path -zcvf target.tar.gz source
参数说明:
-z :是否同时具有 gzip 的属性?
-x :解开一个压缩档案的参数指令!
-t :查看 tarfile 里面的档案!
-c :建立一个压缩档案的参数指令
-v :压缩的过程中显示档案!
-f :使用档名,请留意,在 f 之后要立即接档名喔!不要再加参数!
例如使用『 tar -zcvfP tfile sfile』就是错误的写法,要写成
『 tar -zcvPf tfile sfile』才对喔!
-p :使用原档案的原来属性(属性不会依据使用者而变)
-P :可以使用绝对路径
-N :比后面接的日期(yyyy/mm/dd)还要新的才会被打包进新建的档案中!
--exclude FILE:在压缩的过程中,不要将 FILE 打包!
范例:
[root@test /root]# tar -cvf directory.tar directory
//只将目录整合打包成一个档案
[root@test /root]# tar -zcvf directory.tar.gz directory
除了将目录打包外,同时以 gzip 压缩
[root@test /root]# tar -zcvf filename.tar.gz /home/test/*
将 /home/test/ 这个目录下的档案全部打包并压缩成为一个 filename.tar.gz 的档案
[root@test /root]# tar -jcvf /tmp/etc.tar.bz2 /etc <==打包后,以 bzip2 压缩
[root@test /root]# tar -xvf directory.tar
解 tar 的封包,请注意,由于没有 gzip (.tar 而非 .tar.gz) 的作用,所以只要使用 –xvf 即可!不需要加上 z ,否则会显示有问题!
[root@test /root]# tar -zxvf directory.tar.gz
这个就是有加上 gzip 的压缩的结果!所以需要加上 –z 呦!
[root@test /root]# tar –ztvf directory.tar.gz
这个 t 可以用来查看 tar 里面的档案信息呢!而不需要将他解开!
[root@test /root]# tar -zcvPf home.tar.gz /home
则建立起来的压缩档内档案为绝对路径
请注意,使用这个 P 的参数时,不要将 P 加在 f 后面,因为
f 之后要立即接档名才行喔!
[root@test /root]# tar -N '2002/06/25' -zcvf home.tar.gz /home
上面是说 在 /home 这个目录中,比 2002/06/25 日还要新的档案才会被打包进入 home.tar.gz 这个档案中!
[root@test /root]# tar -zcvf host.tar.gz / --exclude /mnt --exclude /proc
上面是说,将根目录的所有数据都打包进 host.tar.gz 这个档案中,但是 /mnt 及 /proc 则不打包!
[root@test /root]# tar -cvf - /home | tar -xvf -
上面的意思是『将 /home 打包之后,直接解压缩在 /root 底下!』嘿嘿!不需要再建立一次中间档案!不过,使用上面的语法最好使用『绝对路径』,比较不会有问题!这个方式适合不想要建立中间档案时!
Zip和unzip压缩文件
[root@test /root]# zip -r myfile.zip ./* //将当前目录下的所有文件和文件夹全部压缩成myfile.zip文件,-r表示递归压缩子目录下所有文件.
[root@test /root]# zip -d myfile.zip smart.txt //删除压缩文件中smart.txt文件
[root@test /root]# zip -m myfile.zip ./rpm_info.txt //向压缩文件中myfile.zip中添加rpm_info.txt文件
[root@test /root]# unzip -o -d /home/sunny myfile.zip //把myfile.zip文件解压到 /home/sunny/
Rar压缩文件
现在网上多数压缩包是rar格式的,所以需要一个rar工具。
首先在http://www.rarlab.com/download.htm下载RAR 3.60 beta 6 for Linux
我解压到/opt下,会自动建立rar目录。这个工具无需编译可以直接使用。
在$HOME目录下建立bin目录。
在bin目录中建立一个链接。ln -s /opt/rar/rar rar。
就可以用rar工具压缩和解压.rar文件了。不过此工具是命令方式的,和在DOS下的RAR操作是一样的。
這樣就表示已成功啟動,你可以使用 ps -aux |grep Xvnc來查詢是否有啟動,有啟動的話會有下列文字出現
root 2654 0.1 3.9 5028 3808 pts/4 S 11:53 0:00 Xvnc :1 -desktop
安装VNCSERVER
1。System->Administration->Login Screen Setup
Tab Security->Enable XDMCP
Tab XDMCP--> You can disable "Honor Indirect Requests"
2.sudo apt-get install vnc4server xinetd
3。sudo vncpasswd /root/.vncpasswd
4, sudo /etc/init.d/xinetd stop
sudo /etc/init.d/xinetd start
5,vi /etc/.vnc/xstartup
加上:
gnome-session &
注视:
# startkde &
6,系统设置-->服务器设置-->服务”菜单来配置,把vncserver一项选上就可以了。
安装mysql:
http://wiki.ubuntu.org.cn/Quick_HOWTO_:_Ch34_:_Basic_MySQL_Configuration/zh
sudo vim /etc/mysql/my.cnf
修改/etc/mysql/my.cnf
注释掉这句话 bind-address = 127.0.0.1
GRANT ALL PRIVILEGES ON *.* TO splashnote@"%" IDENTIFIED BY "splashnote";
7.设置当前默认的java解释器:
sudo update-alternatives --config java
执行后会出现类似如下的画面:
There are 2 alternatives which provide `java'.
Selection Alternative
-----------------------------------------------
1 /usr/bin/gij-wrapper-4.1
*+ 2 /usr/lib/jvm/java-6-sun/jre/bin/java
Press enter to keep the default[*], or type selection number:输入 有包含 "sun" 的行的前面的数字。如上面显示,则输入2,然后回车确定。
配置JAVA环境变量:
sudo gedit /etc/environment
在其中添加如下两行:
CLASSPATH=.:/usr/lib/jvm/java-6-sun/lib
JAVA_HOME=/usr/lib/jvm/java-6-sun
sudo gedit /etc/jvm
1.
ubuntu默认root密码为空,启动时grub菜单里进revoer 模式,然后可以用passwd root命令给root设密码
2.ifconfig eth0 192.168.1.99 broadcast 192.168.1.255 netmask 255.255.255.0 up
route add default gw xxx.xxx.xxx.netmask xxx.xxx.xxx
3.允许 root登录。网络--安全
4。安装ssh :sudo apt-get install ssh
5.
安装
查看软件xxx安装内容
dpkg -L xxx
查找软件
apt-cache search 正则表达式
查找文件属于哪个包
dpkg -S filename apt-file search filename
查询软件xxx依赖哪些包
apt-cache depends xxx
查询软件xxx被哪些包依赖
apt-cache rdepends xxx
增加一个光盘源
sudo apt-cdrom add
系统升级
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade
清除所以删除包的残余配置文件
dpkg -l |grep ^rc|awk '{print $2}' |tr ["/n"] [" "]|sudo xargs dpkg -P
-
编译时缺少h文件的自动处理
sudo auto-apt run ./configure
查看安装软件时下载包的临时存放目录
ls /var/cache/apt/archives
备份当前系统安装的所有包的列表
dpkg --get-selections | grep -v deinstall > ~/somefile
从上面备份的安装包的列表文件恢复所有包
dpkg --set-selections < ~/somefile sudo dselect
清理旧版本的软件缓存
sudo apt-get autoclean
清理所有软件缓存
sudo apt-get clean
删除系统不再使用的孤立软件
sudo apt-get autoremove
查看包在服务器上面的地址
apt-get -qq --print-uris install ssh | cut -d/' -f2
系统
查看内核
uname -a
查看Ubuntu版本
cat /etc/issue