Linux的常用命令和基本操作

字体大小: 中小 标准 ->行高大小: 标准
Linux的基本思想:1.一切皆文件。
2.由短小切目的单一的程序组成。
3.组合小程序完成大任务。
4.尽可能少的和用户交互。
5.以文本文件的形式保存所有软件的配置信息。

Shell:

Shell是指提供使用者使用界面,将用户的命令转换成二进制的形式交给应用软件。


Shell的分类:图形界面shell(Graphical User Interface shell 即 GUI shell);

                       命令行式shell(Command Line Interface shell 即CLI shell)。


UINX中shell的种类主要包括:sh,ksh和 bash。 

Linux的基本命令和操作:

Linux国际化(linux internationalization,即“i18n”) 

[root@www.inuxidc.com ~]# cat /etc/sysconfig/i18n

LANG="en_US.UTF-8"

SYSFONT="latarcyrheb-sun16" 

通过修改LANG="en_US.UTF-8"来改变linux的语言环境。 

Locale 显示当前语言名字和值: 

[root@www.inuxidc.com ~]# locale

LANG=en_US.UTF-8

LC_CTYPE="en_US.UTF-8"

LC_NUMERIC="en_US.UTF-8"

LC_TIME="en_US.UTF-8"

LC_COLLATE="en_US.UTF-8"

LC_MONETARY="en_US.UTF-8"

LC_MESSAGES="en_US.UTF-8"

LC_PAPER="en_US.UTF-8"

LC_NAME="en_US.UTF-8"

LC_ADDRESS="en_US.UTF-8"

LC_TELEPHONE="en_US.UTF-8"

LC_MEASUREMENT="en_US.UTF-8"

LC_IDENTIFICATION="en_US.UTF-8"

LC_ALL= 

显示所有系统所支持的语言包:

[root@www.inuxidc.com ~]# locale –a 

登出:

[root@www.inuxidc.com ~]# logout 

每个linux可以提供多套终端,由Ctrl + Alt + Fn进行切换;其中1~6为命令行界面,7为图形化界面。 

未启动图形化界面时启动方法:

[root@www.inuxidc.com ~]# startx & 

若要启动更多:

[root@www.inuxidc.com ~]# startx -- :1 

在命令行界面上下翻屏:Shift + PgUp / PgDn

 

在命令行界面中复制/粘贴快捷键:Ctrl + Shift + c复制;Ctrl + Shift + v 粘贴。 

更改开进默认进入界面:

[root@www.inuxidc.com ~]# vim /etc/inittab

id:3:initdefault: 默认进入文字界面

id:5:initdefault: 默认进入图形界面 

用户密码修改:

[root@www.inuxidc.com ~]# passwd 用于修改root密码 修改时需要提供旧密码

[root@www.inuxidc.com ~]# passwd + user 用于修改指定用户密码 以root身份修改时 无需提供旧密码

 

切换用户SwitchUser:

[root@www.inuxidc.com ~]# su student  su后不跟任何选项直接跟用户 不完全切换

[student@www.linuxidc.com root]$

[root@www.inuxidc.com ~]# su -l student  su后跟 –l 或 – 再加用户  完全切换

[student@www.linuxidc.com ~]$ 

查看此前所有执行过的指令:

eg:

[root@www.inuxidc.com ~]# history

    1  mount /dev/cdrom /mnt

    2  cd /mnt

    3  ls

    4  reboot

    5  ls /mnt

    6  mount /dev/cdrom /mnt

    7  ls /mnt

    8  rpm -ivh /mnt/VMwareTools-6.0.2-59824.i386.rpm

    9  cd ..

   10  wm

   11  cd ..

   12  umount /dev/mount

↑ ↓ 对近期执行过的指令进行切换。

[root@www.inuxidc.com ~]# !+ num  表示第num条命令;

[root@www.inuxidc.com ~]# !+ string 表示离现在最近与string想匹配的命令;

[root@www.inuxidc.com ~]# !!        表示执行上一条指令;

 

引用上一条指令中的参数(即命令作用对象):

eg:

[root@www.inuxidc.com ~]# cat /etc/sysconfig/i18n

若此时仍想对/etc/sysconfig/i18n进行vim编辑即可输入

[root@www.inuxidc.com ~]# vim !$

[root@www.inuxidc.com ~]#vim 按住Alt +  .

[root@www.inuxidc.com ~]#vim 短按Esc+  .

 

通过环境变量HISTCONTROL设置history的记录规则:

[root@www.inuxidc.com ~]#export HISTCONTROL=ignorespace 以空格开头的命令在history中不予记录;

[root@www.inuxidc.com ~]#export HISTCONTROL=ignoredups 在history中出现过两次以上的命令只记录一次;

[root@www.inuxidc.com ~]#export HISTCONTROL=ignoreboth 空格不予记录且命令只记录一次;

撤销HISTCONTROL:

[root@www.inuxidc.com ~]#export HISTCONTROL=

[root@www.inuxidc.com ~]#unset HISTCONTROL

清空history记录:

[root@www.inuxidc.com ~]#history –c

此文章由 http://www.ositren.com 收集整理 ,地址为: http://www.ositren.com/htmls/59573.html