当前位置: 代码迷 >> 综合 >> Linux学习笔记(二)--Linux启动顺序、常用命令
  详细解决方案

Linux学习笔记(二)--Linux启动顺序、常用命令

热度:32   发布时间:2024-01-09 19:31:54.0

Linux的启动顺序

1.load  BIOS(hardware  information)

2.read MBR's config to find out the OS

3.load the kernel of the OS

4.init process starts...

5.execute /etc/rc.d/sysinit       rc.d后台默默启动的进程

6.start other modules(etc/modules.conf)

7.execute the run level scripts

8.execute /etc/rc.d/rc.local

9.execute /bin/login

10.shell started...

Linux是内核启动。分层启动。分七个层次   层次和层次之间没有关系。

init n

0--系统停机状态

1--单用户工作状态

2--多用户工作状态(没有NFS)

3--多用户工作状态(有NFS

4--系统未使用,留给用户

5--图形界面

6--系统正常关闭并重新启动


cd /etc       /etc 很重要


exit   退出

shutdown  关机

reboot   重启

loginout 


帮助

man  shutdown

shutdown  --help



常用命令:

ls


ls -l  下面以d开头都是目录,以-开头都是文件。


cd  


pwd  当前路径是什么


mkdir

mkdir lgd  


rmdir   只能删除为空的目录

rmdir   d1

rm -r  d1

rm -rf d1


touch  创建文件

touch  1


ls -R  查看目录结构

cp 1 2    复制文件


cp  -r   d1 d2   复制目录


mv  dd1  ../   移动目录


自学 = 查询 + 学习  + 经验积累 + 动手试


vi
文本编辑器

vi   3.txt

命令模式

编辑模式  

a     从命令到编辑

Esc 从编辑到命令  :+ 命令    :wq存盘退出


 more 3.txt   列出文件的内容


命令模式   dd  删除一行


cat   3.txt  正序

tac   3.txt  逆序


head -3 3.txt  列出前三行

tail -1 3.txt  列出最后一行


find /etc -name *local   查找


whereis   

whereis  ls


echo  $PATH

windows分割符 ;      Linux/Unix下分割符 :


ln  链接

ln 3.txt   4       硬链接    关联到一起,改变3.txt的内容4也会变。   

ln -s 3.txt  5    软链接


删除3.txt   看区别    ls -l  

硬链接和软链接

硬链接相当于拷贝了在创建链接

软链接相当于创建了快捷方式


简单用户管理:

useradd testuser

useradd -m testuser2   添加新用户到/home目录


passwd  testuser2   为用户指定密码


groupadd testg   添加组

more group  


useradd testuser3 -g testuser    添加用户并指定它的组

usermod -g testg testuser    修改原来user的组



userdel  testuser2    删除用户

 rm  -rf   testuser2;      删除用户目录



 su mark   切换用户

切换用户后的目录是当前用户的主目录