设为首页 加入收藏

TOP

Linux基础和命令(一)
2023-07-23 13:33:25 】 浏览:55
Tags:Linux

Linux的哲学思想

优势

  1. 一切都是一个文件。(包括硬件,文本,二进制,源代 码)
  2. 系统中拥有小型,单一用途的程序。(一个程序只负责 做好自己的本职工作)
  3. 当遇到复杂任务,通过不同功能用途的程序组合起来 完成。 轻量级,一台服务 dhcp ip 数据库服务 网 页
  4. 避免令人困惑的用户界面就是没有复杂的图形界面。 ()我想怎么使用程序,win程序
  5. 连配置文件都存储在文本中,方便增删改查。
  6. 不在乎后缀名,有没有都无所谓,不是通过后缀名来 定义文件的类型。

基础知识


root             #表示用户
localhost                  #主机名
~                     #家目录
#                #管理员用户
$                 #普通用户
root                #root的家目录
opt             #opt目录

关机命令:
1、halt            #立刻关机
2、poweroff                   #立刻关机
3、shutdown -h now      #立刻关机(root用户 使用)
4、shutdown -h 10       #10分钟后自动关机

重启命令:
reboot
init 6
shutdown -r now

Linux命令

shell

shell的定义

 

 

 用户使用应用程序发布指令比如 (使用浏览器访问网页) 

shell去通知操作系统需要进行什么样的操作(相当于解释层)
内核相当于操作系统去指挥硬件 硬件才能工作,否则无法交互

不同的shell环境

bash是linux里面默认的shell程序位于/bin/bash csh ksh 语言不同比如中文英文都是交流的语言

[root@localhost ~]  # echo $SHELL //显示当前shell
/bin/bash
[root@localhost ~]  # cat /etc/shells //显示当前系统所有使用的shell
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
/bin/tcsh
/bin/csh
[root@localhost mnt]# sh 切换shell环境 sh-4.2# [root@localhost mnt]# pstree 查看使用过的shell环境 ├─sshd───sshd───bash───csh───bash───tcsh ───bash───pstree
├─systemd-journal
├─systemd-logind
├─systemd-udevd
├─tuned───4*[{tuned}]
├─upowerd───2*[{upowerd}]
├─vmtoolsd───{vmtoolsd}
├─wpa_supplicant
└─xdg-permission-───2*[{xdg-permission-}]

 

shell与内、外部命令

(1) shell 分为内部命令和外部命令,一般先执行内部命令,hash 再执行外部命令

内部命令 外部命令
集成于Shell解释器程序内部 的一些特殊指令,也称为内 建(Built-in)指令 Linux系统中能够完成 特定功能的脚本文件 或二进制程序
属于Shell的一部分 属于Shell解释器程序 之外的命令
没有单独对应的系统文件 每个外部命令对应了 系统中的一个文件
自动载入内存,可以直接使 用 必须知道其对应的文 件位置,由Shell加载 后才能执行

 

 

 

 

 

 

 

(2)help命令可以查看内部命令

[root@localhost ~]# help cd
cd: cd [-L|[-P [-e]]] [dir]
Change the shell working directory.

Change the current directory to DIR. The default DIR is the value of the
HOME shell variable.

The variable CDPATH defines the search path for the directory containing
DIR. Alternative directory names in CDPATH are separated by a colon (:).
A null directory name is the same as the current directory. If DIR begins
with a slash (/), then CDPATH is not used.

If the directory is not found, and the shell option 'cdable_vars'is set,
the word is assumed to be a variable name. If that variable has a value,
its value is used for DIR.

Options:
-L        force symbolic links to be followed
-P       use the physical directory structure without following symbolic
links
-e            if the -P option is supplied, and the current working directory


cannot be determined successfully, exit with a non-zero status

The default is to follow symbolic links, as if '-L' were specified.

Exit Status:
Returns 0 if the directory is changed, and if $PWD is set successfully when
-P  is used; non-zero otherwise.

 

(3)可以使用type 命令来区分内外部命令

[root@localhost /]             # type cd

首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇正则表达式 下一篇Ubuntu 通过本机代理修复 NuGet ..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目