linux基础指令及文件说明
目录
计算机基础知识
计算机由哪些硬件组成:
输入设备:键盘,鼠标,触摸屏,扫描仪,麦克风
输出设备:显示屏,打印机,音响
存储器:内存
运算器
控制器
计算机的种类:pc,手机
机器语言
了解硬件的相关功能函数
程序不具有可移植性
程序具有专一性
编译器:c语言,c++,c#夏普,java
操作系统:管理计算机硬件的一组程序叫做操作系统内核,系统调用接口
操作系统内核功能:
系统调用接口
程序管理
内存管理,虚拟内存—内存交换
文件系统管理
设备驱动
常见的操作系统:Android,linux,ios,windows,unix,wp
终端:也称为终端设备,是计算机网络中处于网络最外围的设备,主要用于用户信息的输入以及处理结果的输出等。
虚拟终端
同一台终端(物理设备)上虚拟出多个终端,它们之间互相不影响,这些终端就是虚拟终端
默认有6个
ctrl + alt +f1/2/3/4/5/6
linux基础文件介绍及指令
远程连接 修改密码
[root@localhost ~]#
用户名 本地主机 家目录 #超级用户的命令提示符,$普通用户的命令提示符
dhclient 使用dhcp获取ip地址。Dynamic Host Configuration Protocol动态主机配置协议
ip a 查看ip地址
强制终止进程:kill -9 进程号
ssh ip地址
ssh 用户名@ip地址
pwd打印当前工作目录
root用户的家目录:/root
普通用户的家目录:/home/xxx
passwd 修改密码
-d删除密码
root用户:不需要输入原密码,可以不符合密码复杂性规则,可以给任何人修改密码
普通用户:需要输入原密码,必须符合密码复杂性规则,passwd修改密码无法跟参数
修改主机名:
hostnamectl set-hostname 主机名
切换用户:su - 用户名
exit
切换目录:cd
绝对路径:以/开头的路径叫做绝对路径
[root@localhost ~]#cd /home/student
[root@localhost student]#
相对路径:不是以/开头的路径叫做相对路径
[root@localhost home]# cd student
[root@localhost student]#
.当前目录
…上一级目录
-当前目录和上一级目录之间来回切换
破解密码
描述一破解root密码:
1、重启虚拟机
2、在linux16末尾加上 rd.break,ctrl+x执行
3、mount -o remount,rw /sysroot
4、chroot /sysroot
5、passwd root
6、输入新密码:
7、确认密码
8、touch /.autorelabel
9、exit
10、exit
描述二https://jingyan.baidu.com/article/e75aca85799862142edac6a5.html
第1步:开机后在内核上敲击“e”。
第2步:在linux16这行的后面输入“rd.break”并敲击“ctrl+x“
第3步:进入到了系统的紧急求援模式。
第4步:依次输入以下命令:
mount -o remount,rw /sysroot
chroot /sysroot
echo “linuxprobe” | passwd --stdin root
touch /.autorelabelexitreboot
第5步:重启时会很慢,耐心等待即可。
描述三root密码破解:
1.Reboot the system.
2.Interrupt the boot loader count down by pressing anykey.
3.Move the cursor to the entry that needs to be booted.
4.Press “e” to edit the select edentry.
5.Move the cursor to the kernel command line(the line that start swith linux16.
6.Append rd.break.
7.Press Ctrl+x to start.
8.Remount /sysroot as read-write.
switch_root:/# mount -o remount,rw /sysroot
9.Switch into a chroot jail, where /sysroot is treated as the root of the filesystem tree
switch_root:/# chroot /sysroot
10.Set a new root password:
sh-4.2# passwd [root] (change the root password)
or
sh-4.2# passwd -d root (delete the root password)
11.Make sure that all unlabeled files (including/etc/shadow at this point)get relabeled during boot.
sh-4.2# touch /.autorelabel
12. sh-4.2# exit
13. switch_root:/# exit
文件相关
命令格式:命令 选项 参数
列出当前目录下的内容:ls
-l 长列表列出目录下的内容=ll
ls -l /home 长列表列出/home的内容
-a 列出所有文件,包括.和…
-A 列出所有文件,不包括.和…
-ld 长列表列出当前目录的详细信息
-i 显示文件索引节点号(inode)。一个索引节点代表一个文件,在linux中保存在磁盘分区中的文件都给它分配一个编号,称为索引节点号inode。
-lh 进行单位转换
-r 逆序列出当前目录下的内容
man ls
-rw-------. 1 ro