实验楼linux指令,Linux 学习笔记--来自实验楼<1>

Linux 系统介绍

linux 基本概念及操作

shell 命令:

· echo "Hello world" ==> 每一种语言都有的打印hello world

· 无意中多输入了些命令,或者写错了。 可以用ctrl+c 去退出。 比如如下命令:

Allens-MacBook-Air:~ allenliu$ tail

^C

Allens-MacBook-Air:~ allenliu$

· 常用快捷键:

Ctrl+d 键盘输入结束或者退出

Ctrl+s 暂停当前程序

Ctrl+z 将程序放置到后台,恢复到前台的命令是fg

Ctrl+a 讲光标移动到行头

Ctrl+e 将光标移动到行尾

Ctrl+K 删除光标所在位置到行尾

Alt+ Backspace 向前删除一个单词

· 使用通配符

实际上相当于正则的用法。可以用* 跟 ? 来进行模糊匹配

Allens-MacBook-Air:desktop allenliu$ ls *.plist

QT0-NED.plist QT0-NED_units_dictionary.plist

QT0-NED_units.plist QT0-NED_units_dictionary_modified.plist

Allens-MacBook-Air:desktop allenliu$

· 批量创建文件

touch 命令:

Allens-MacBook-Air:desktop allenliu$ touch Love_{1..2}_text.txt

Allens-MacBook-Air:desktop allenliu$

查看帮助

命令如下: man man

man 命令包括的主要区段如下

一般命令

系统调用

库函数,涵盖了C标准库

特殊文件和驱动程序

文件格式和约定

游戏和屏保

杂项

系统管理命令和守护进程

使用的具体方法:

Allens-MacBook-Air:desktop allenliu$ man 1 ls

LS(1) BSD General Commands Manual LS(1)

NAME

ls -- list directory contents

SYNOPSIS

ls [-ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1] [file ...]

DESCRIPTION

For each operand that names a file of a type other than directory, ls

displays its name as well as any requested, associated information. For

each operand that names a file of type directory, ls displays the names

of files contained within that directory, as well as any requested, asso-

ciated information.

Linux 用户及文件权限管理

用户管理

查看用户:

Allens-MacBook-Air:desktop allenliu$ who am i

allenliu ttys000 Oct 5 21:24

who 下面的常用参数:

Allens-MacBook-Air:desktop allenliu$ who -a

reboot ~ Oct 5 20:57 . 1

allenliu console Oct 5 20:58 00:56 107

allenliu ttys000 Oct 5 21:24 . 2384

. run-level 3

Allens-MacBook-Air:desktop allenliu$ who -d

Allens-MacBook-Air:desktop allenliu$ who -m

allenliu ttys000 Oct 5 21:24

Allens-MacBook-Air:desktop allenliu$ who -q

allenliu allenliu

# users = 2

Allens-MacBook-Air:desktop allenliu$ who -u

allenliu console Oct 5 20:58 00:57 107

allenliu ttys000 Oct 5 21:24 . 2384

Allens-MacBook-Air:desktop allenliu$ who -r

. run-level 3

Allens-MacBook-Air:desktop allenliu$

创建用户

sudo 用来执行一些需要特权的命令,比如 adduser

su 用来切换用户

Cat 命令

Cat 命令用来读取制定文件的内容把那个打印到终端输出, | sort 表示将读取的文本进行一个字典排序。

Allens-MacBook-Air:desktop allenliu$ cat /etc/group | sort

#

#

# Group Database

# Note that this file is consulted directly only when the system is running

# Open Directory.

# Open Directory.

# See the opendirectoryd(8) man page for additional information about

# in single-user mode. At other times this information is provided by

##

##

_amavisd:*:83:

_appleevents:*:55:

_applepay:*:260:

_appowner:*:87:

_appserveradm:*:81:

_appserverusr:*:79:

_appstore:*:33:

_ard:*:67:

_assetcache:*:235:

_astris:*:245:

_atsserver:*:97:

_calendar:*:93:_teamsserver

_captiveagent:*:258:

_ces:*:32:

_clamav:*:82:

_coreaudiod:*:202:

_coremediaiod:*:236:

_ctkd:*:259:

_cvms:*:212:

_cvs:*:72:

· 删除用户

sudo deluser Allen --remove -home

文件权限

用较长的格式列出文件:

ls -l

logoblackfont

image

logoblackfont

image

logoblackfont

iamge

· 变更文件所有者

cd /home/lilei

ls iphone6

sudo chown allen iphone6 ==> change ownship

cp iphone6 /home/allen ==> copy file

改变文件的权限

二进制表示:

每个文件有三种权限,(拥有者,所属用户组,其他用户)。每组权限都对应着一个r'w'x。也就是如图所示的7

logoblackfont

image

echo "echo \"hello world\"" >iphone6

chmod 700 iphone6

2, 另外一种方式是:加减赋权的方法

g->group

o->other

u->user

对于文件还可以这样

chmod go -rw iphone

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值