首页 > 系统相关 >LINUX学习笔记

LINUX学习笔记

时间:2023-03-25 15:22:43浏览次数:44  
标签:learn LINUX ubuntu 笔记 Desktop 学习 html zzh home

Linux学习笔记1

VMware Workstation Pro中打开虚拟机后,

1.文件操作

(1)进入到home文件夹.

zzh@ubuntu:/$ cd home
zzh@ubuntu:/home$ 

(2)在home文件夹中添加一一个新的文件夹,叫做learn_ linux.

zzh@ubuntu:/home$ mkdir -m 711 learn_linux
mkdir: cannot create directory ‘learn_linux’: Permission denied
zzh@ubuntu:/home$ sudo mkdir -m 711 learn_linux
[sudo] password for zzh: 
zzh@ubuntu:/home$ ls
learn_linux  

这里直接执行命令会因为权限不足,可以sudo command创建目录。

(3)进入到learn_ linux 文件夹.

zzh@ubuntu:/home$ cd learn_linux

(4)新建一一个文件,叫做a(注意不要有拓展名).

zzh@ubuntu:/home/learn_linux$ sudo touch a

(5)使用vi修改a这个文件,在文件中写人“Nahida Best"

zzh@ubuntu:/home/learn_linux$ sudo vi a

进入后按i进入编辑模式

  • vi 操作)

(6)查看a里面的内容(提示:cat)

zzh@ubuntu:/home/learn_linux$ cat a
Nahida Best

(7)将文件a复制到桌面

zzh@ubuntu:/home/learn_linux$ cp a ~/Desktop
zzh@ubuntu:/home/learn_linux$ cd ~/Desktop
zzh@ubuntu:~/Desktop$ ls
a 

(8)将文件a移动到桌面

zzh@ubuntu:/home/learn_linux$ sudo mv a ~/Desktop

(9)使用命令查看桌面有什么内容

zzh@ubuntu:/home/learn_linux$ cd ~/Desktop
zzh@ubuntu:~/Desktop$ ls
a

(10)删除掉learn_ linux 文件夹.

zzh@ubuntu:/home$ sudo rmdir -p learn_linux

(11)删除掉桌面上的a文件.

zzh@ubuntu:/home$ cd ~/Desktop
zzh@ubuntu:~/Desktop$ rm a
rm: remove write-protected regular file 'a'? y

2.软件包更新

1.更换软件源
  1. 备份官方软件源 sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
  2. 无安装 vim 编辑器的,执行 sudo vi /etc/apt/sources.list 有安装 vim 编辑器的,执行: sudo vim /etc/apt/sources.list
  3. 将所有未注释的配置注释或者删除
  4. 将对应版本的镜像源复制粘贴到 sources.list (以阿里云镜像源为例,其他源类似)
  5. 更换源后记得更新一下源和软件 sudo apt-get update && sudo apt-get upgrade
  6. 如果出现依赖问题,执行 sudo apt-get -f install
2.安装git

1.尝试运行git init, 看看控制台的报错信息.根据报错使得这个
命令顺利运行

zzh@ubuntu:~$ git init
Command 'git' not found, but can be installed with:
sudo apt install git
zzh@ubuntu:~$ sudo apt install git

3.Linux权限管理

运行shell脚本前需要为脚本设置可执行权限chmod +x test.sh

4.shell脚本编写

写一个脚本,使得可以批量生成名字为1-40 的文件.体验Shell脚本的方便性。

1.编写脚本

for  i in `seq 1 40`
do
        touch ~/Desktop/test1/${i}.html
done

2.执行

zzh@ubuntu:~/Desktop/test1$ chmod +x test1.sh
zzh@ubuntu:~/Desktop/test1$ sh test1.sh
zzh@ubuntu:~/Desktop/test1$ ls -tr
test1.sh  2.html  5.html  7.html  9.html  11.html  13.html  15.html  16.html  18.html  21.html  22.html  24.html  27.html  28.html  30.html  32.html  33.html  35.html  38.html  40.html
3.html    1.html  4.html  6.html  8.html  10.html  12.html  14.html  19.html  17.html  20.html  25.html  23.html  26.html  31.html  29.html  34.html  36.html  39.html  37.html

5.Linux运行c语言

1.编译执行c语言

zzh@ubuntu:~/Desktop$ gcc hello.c -o hello
zzh@ubuntu:~/Desktop$ ./hello
Hello World!
linux 运行c语言

2.输出汇编文件

要输出汇编文件zzh@ubuntu:~/Desktop$ gcc -S -o hello.s hello.c

	.file	"hello.c"
	.text
	.section	.rodata
.LC0:
	.string	"Hello World!"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

3.进入其他文件夹运行hello

(1)直接进入并运行

zzh@ubuntu:/home/learn$ ./hello
bash: ./hello: No such file or directory

(2)更改全局变量

zzh@ubuntu:~/Desktop$export PATH="$HOME/Desktop:$PATH"
zzh@ubuntu:~/Desktop$cd /home/learn
zzh@ubuntu:/home/learn$hello
Hello World!

标签:learn,LINUX,ubuntu,笔记,Desktop,学习,html,zzh,home
From: https://www.cnblogs.com/freeman12138/p/17254784.html

相关文章

  • linux部署tomcat,tomcat无法启动一直卡在starting ZkClient event thread的解决办法
    近期迁移服务到新的服务器,启动tomcat后,去网页访问时,发现无法访问,只能去看tomcat日志,发现日志里面一直卡在startingZkClienteventthread然后又去ps-ef|greptomcat......
  • 【华为OD机试真题2023 JAVA】Linux发行版的数量
    Linux发行版的数量知识点DFS搜索BFS搜索并查集时间限制:1s空间限制:256MB限定语言:不限题目描述:Linux操作系统有多个发行版,distrowatch.com提供了各个发行版的资料。这些发......
  • linux操作--1
    快照---Linux中快照功能类似于备份,当我们在操作linux系统时担心系统会出未知的异常,可以将系统进行备份。在vmware中右击想要操作的系统就能找到。2.**克隆与移植---l......
  • 读书笔记-《人月神话》-2
    对于软件本身的复杂性,作者得出的结论是,当前没有任何方法能使软件的生产率提高一个数量级。但作者并没有消极的接受这个结论。而是深入分析了软件复杂性到底是如何导致软件......
  • 集合幂级数学习笔记
    定义有时候我们会研究定义域在集合上的函数:考虑一个固定的全集\(U\)和其幂集\(2^U\),我们有一些\(2^U\rightarrowF\)的函数,其中\(F\)是某个域。对于定义在集合上的......
  • java——Zookeeper学习——zk概览转载
    一、ZooKeeper简介ZooKeeper是一个分布式协调服务,提供了诸如数据发布/订阅、负载均衡、命名服务、分布式协调/通知和分布式锁等分布式基础服务。1.1、数据结构ZooKeeper......
  • 深度学习-线性代数
    1.标量仅包含一个数值被称为标量。2.向量向量被视为标量值组成的列表,这些标量被称为向量的元素,在数学上,具有一个轴的张量表示向量。一般来说,张量可以具有任意长度,这取......
  • java学习日记20230325-模版设计模式
    模版设计模式利用多态的动态绑定,将通用的方法设计为模版抽象类,通过子类继承重写抽象方法实现模版调用。 父类抽象类abstractpublicclassTemplate{......
  • Markdown语法学习
    Markdown学习标题:#+空格+标题名字二级标题##+空格+标题名字三级标题同理最多六级标题字体Hello,World!粗体:两边+**Hello,World!斜体:两边+*Hello,World!粗......
  • linux三剑客之grep详解
    1.什么是Grepgrep(GolobalRegularExpressionprint)是Linux系统中一个强大的文本搜索工具,也是俗称的搜索三兄弟之一,其他两个是awk和sed,grep可以把搜索到的内容打印到屏......