红联Linux门户
Linux帮助

一些linux学习笔记

发布时间:2007-12-14 21:06:38来源:红联作者:Modegle
  建立ext3文件系统
  mkfs -t ext3 /dev/hdxy
  
  ==========
  改变文件授权
  chmod u+x, g+w, o-r /test1/file1
  chmod u=rwx, g=rw /test1/file1
  
  ==========
  对目录授权
  chmod -R u=rw, g=rw, o=rw /test1/*
  
  ==========
  dd
  dd if=/dev/fd0 of=floppyfile
  dd if=boot.img of=/dev/fd0 bs=1440k
  转换大小写
  dd if=./lowercase of=./uppercase conv=ucase
  
  ==========
  磁盘空间使用
  du -h
  du -hs 显示总计
  du -ah 显示所有文件及目录
  
  ==========
  mount
  设备名称 安装目录 文件系统 选项 Dump Pass
  LABEL=/ / ext3 defaults 1 1
  /dev/cdrom /mnt/cdrom udf,iso9660 iocharset=cp936,auto,owner,kudzu,ro,user 0 0
  
  ==========
  Quota
  1
  fstab
  LABEL=/home /home ext3 defaults,usrquota,grpquota 1 2
  
  2
  reboot
  
  3
  quotacheck -avgu
  
  4
  chmod 600 /home/aquota.usr
  touch /home/aquota.group
  
  5
  quota user1
  
  6
  edquota -u user1
  
  7
  quotaon -aguv
  quotaoff -aguv
  
  ==========
  批量建立用户
  1建立/root/accounts.txt
  user1:x:601:601::/home/user1:/bin/bash
  
  2
  /usr/bin/newusers < /root/accounts.txt
  
  3
  /usr/sbin/pwunconv
  
  4建立/root/password.txt
  user1:q1w2e3r4
  
  5
  /usr/sbin/chpasswd < /root/password.txt
  
  6
  /usr/sbin/pwconv
  
  ==========
  帮助、查找
  man passwd | col -b > passwd.txt
  
  whatis man
  
  apropos man
  
  find / -name apache -print
  find / -user root
  find / -name core -print -exec rm -rf {} \;
  find /home -perm 600
  find / -size +100k -print
  
  locate man
  update
  
  whereis man
  
  which man reboot
  
  ==========
  进程控制与管理
  ps -l
  ps -u 显示进程关于用户等详细信息
  ps -x 显示后台运行进程信息
  
  top
  P 按CPU使用率排序
  M 按内存使用量排序
  T 按运行时间长短排序
  u 选择特定用户
  top -d 10
  
  nice
  nice -19 ls -ar / &
  nice --20 ls -ar / &
  renice -20 67890
  renice 19 67890
  
  =========
  计划任务
  /etc/crontab
  分钟 小时 日期 月份 星期 命令
  0-59 0-23 1-31 1-12 0-6(sun-mon)
  crontab -e
  
  anacron
  rpm -qa anacron
  
  ==========
  tar
  tar cvf test.tar /tmp/*
  tar xvf test.tar
  tar hcvf test.tar /tmp/* 保存链接源文件
  tar rvf test.tar /tmp/newfile 添加新文件到tar
  
  ==========
  shell
  echo `date` 使用命令结果替代``内容
  ls -al ; cat /tmp/file 分割多个命令
  ls [A-z]* []指定字符范围
  ls [!AaBb]* -al 指定字符范围以外的文件
  
  ==========
  shell配置文件
  /etc/profile 每次登录时运行
  ~/.bash_profile 用户环境配置,每次登录时运行
  ~/.bashrc 每次运行bash时运行
  ~/.bash_login 用户每次登录时运行
  ~/.bash_logout 用户注销时运行
  ~/.profile 与~/.bash_profile功能一样
  ~/.bash_history 命令历史
  
  ==========
  X11增加字体
  1
  mkdir /usr/share/fonts/myfonts/
  
  2
  touch /usr/share/fonts/myfonts/fonts.dir
  
  3
  chkfontpath --add /usr/share/fonts/myfonts/
  
  4
  cp *.ttf /usr/share/fonts/myfonts
  
  5
  ttmkfdir -d /usr/share/fonts/myfonts/ -o /usr/share/fonts/myfonts/fonts.scale
  
  6
  service xfs reload
  
  配置X:rehat-config-xfree86
  
  startx
  
  xinit
  xinit
  ~/.xinitrc 或者 /etc/X11/xinit/xinitrc
  ~/.Xclients 或者 /etc/X11/xinit/Xclients
  运行窗口管理程序
  
  配置xfs启动
  ntsysv
  chkconfig
  chkconfig --level 5 xfs on
  
  
  ==========
  GnuPG
  生成Key Pair
  1 gpg生成Key Pair,并自动建立~/.gnupg目录保存生成的文件
  gpg --gen-key
  选择默认选项完成,并输入用户信息,主要是对应的email,例如mail@mail.com,及Passphrase(相当于Password)
  
  2
  gpg --list-keys
  
  导出Public Key
  gpg --armor --export mail@mail.com > mykeys.asc
  
  将Public Key传送到Pulic Key Server供其它接收方获取
  访问www.keyserver.net将生成的Public Key文件内容在ADD A KEY页面上传至服务器
  
  客户端导入Public Key
  访问www.keyserver.net,使用建立者email搜索Public Key,选择下载并保存至文件newkey.txt
  gpg --import newkey.txt
  
  加密文件
  gpg --output test.gpg --encrypt --recipient mail@mail.com test.txt
  
  解密文件
  gpg --output test.txt --decrypt test.gpg
  需要提供建立Key Pair时输入的Passphrase进行解密
  
  建立数字签名
  gpg --output test.sig --sign test.txt
  
  验证数字签名
  gpg --output verify.txt --decrypt test.sig
  
  加密+签名
  gpg --output test --sign --encrypt --recipient 接收方的ID test.txt
  
  解密+验证
  gpg --output test.txt --decrypt test
文章评论

共有 1 条评论

  1. zhaoxun520bbc 于 2007-12-14 22:42:23发表:

    好东西,支持,最希望就是看到别人的笔记,能减少自己很多摸索过程