【Linux】Linux基础命令 - Go语言中文社区

【Linux】Linux基础命令


一、系统启动一般流程

1.1 Windows

启动
挂在C盘 D盘
启动
BIOS
Windows 内核
系统盘 应用盘
应用程序

1.2 Linux

启动
挂载
启动
Bootloader
Linux 内核
根文件系统
应用程序

在这里插入图片描述

1.2.1 Linux简单驱动程序框架

  • GPIO举例
    在这里插入图片描述

二、S3C2440内部资源

  • 内核:ARM920T
  • 16/32位RICS体系结构
外设
1个LCD控制器( 支持STN和TFT的液晶显示屏)
SDRAM控制器
SD接口
MMC卡接口
看门狗计数器
117位通用/O口
24位外部中断源
4个具有PWM功能的计定时器和1个内部时钟
3个通道的UART
4个通道的DMA
I2C总线接口
2个USB主机接口
1个USB设备接口
2个SPI接口
8通道10位AD控制器

三、命令入门

3.1 终端Teminal

  • Ctrl+Alt+T启动

  • 查看环境变量路径

    • echo $PATH
  • 设置PATH环境变量添加我们自己的目录:

    • exprot PATH=$PATH:/my/dir
  • 文件设置可执行权限

    • chomd +x 文件名

3.2 Linux命令提示符

在这里插入图片描述

  • ~表示家目录
  • $表示普通用户
  • #表示root管理员

3.3 Linux命令的格式

在这里插入图片描述

  • 命令 [选项] [参数]

eg:

  • ls
  • ls -l
  • ls -l /home

3.4 常见命令含义

  • pwd
    • 打印当前所在路径(print working directory

  • cd
    • 切换路径(change directory
      • cd ~ 切换至当前用户的家目录
      • cd . 切换至当前路径
      • cd … 切换至上一级路径
      • cd …/… 切换至上上级路径
      • cd - 切换至上一次路径

  • ls
    • 列出目录内容(list
      • -l(long的缩写)显示目录下详细的信息(文件权限、最后修改时间、文件大小)
      • -a(all的缩写)显示了隐藏文件(以.为开头为隐藏文件)
      • -h(human-able的缩写)将文件大小以K(KB)、M(MB)、G(GB)来表示

  • mkdir
    • 创建目录(make directory
      • mkdir dir0 创建dir0这个目录
      • mkdir -p 父目录/子目录

  • rmdir
    • 删除目录(remove directory
      • 不能删除非空目录
      • rm -r 即可删除非空目录(-r为递归删除的含义:意思是删除当前目录下所有文件和文件夹)

  • mv
    • 重命名/移动(move
    • mv 旧文件名 新文件名(修改文件名)
    • mv 旧目录名 新目录名(修改目录名)
    • mv 文件名 目录名(移动路径)

  • touch
    • 新建文件

  • cp
    • 复制(copy
      • cp -r dir1 dir2 复制dir1目录下所有内容至dir2(-r参数为递归复制)

  • rm
    • 删除文件(remove
      • rm -i file 删除文件file前,要求你是否同意删除(y表示同意,n表示取消)
      • rm -r dir 删除整个dir目录
      • rm -ir dir 删除目录dir前,要求你是否同意删除其中的每一个文件(每次都会询问)

  • cat
    • 查看(catenate
      • cat -n file 以显示行号的方式输出

  • clear
    • 刷新屏幕(保留历史命令记录)

  • reset

    • 重新初始化屏幕(清除历史命令记录)
  • man

    • 手册、帮助(manual
    • man man 查看man命令含义
    • man 2 open 查看open库函数含义
      • 1 可执行程序或 shell 命令
        2 系统调用(内核提供的函数)
        3 库调用(程序库中的函数)
        4 特殊文件(通常位于 /dev)
        5 文件格式和规范,如 /etc/passwd
        6 游戏
        7 杂项(包括宏包和规范,如 man(7),groff(7))
        8 系统管理命令(通常只针对 root 用户)
        9 内核例程

  • wc
    • 统计(word count
    • 统计(行数、字数、大小)

  • ps
    • 进程状态查看(processes status )
    • ps -aux

  • kill
    • 关闭进程(kill后接 进程PID号)

  • uname
    • 查看系统名称(unix name)

3.5 rm -rf /*的含义

  • rm -rf /*
    Linux的目录是使用 / 之类的目录形式存放,rm 是Linux的删除命令,后面带的“-rf”,"-r"指的是 递归删除(意思是删除当前目录下所有文件和文件夹),而“-f”指的是 强制删除 。后方的/*指的是 根目录“/”下的所有文件。即删除根目录下所有内容。

3.6 相对/绝对路径

  • /home/pi 是绝对路径
  • 相对路径一般以.或…构成
    • 当前路径为/bin,./pwd就是直接执行pwd程序
    • 当前路径为/home/pi/Picture,输入cd …/Music 切换至/home/pi/Music

四、附录:常见Linux命令英文全称

linux 命令英文全称

su:Swith user  切换用户,切换到root用户
cat: Concatenate  串联
uname: Unix name  系统名称
df: Disk free  空余硬盘
du: Disk usage 硬盘使用率
chown: Change owner 改变所有者
chgrp: Change group 改变用户组
ps:Process Status  进程状态
tar:Tape archive 解压文件
chmod: Change mode 改变模式
umount: Unmount 卸载
ldd:List dynamic dependencies 列出动态相依
insmod:Install module 安装模块
rmmod:Remove module 删除模块
lsmod:List module 列表模块
alias :Create your own name for a command
bash :GNU Bourne-Again Shell  linux内核 
grep:global regular expression print
httpd :Start Apache
ipcalc :Calculate IP information for a host
ping :Send ICMP ECHO_Request to network hosts
reboot: Restart your computer
sudo:Superuser do
 
/bin = BINaries 
/dev = DEVices 
/etc = ETCetera 
/lib = LIBrary 
/proc = PROCesses 
/sbin = Superuser BINaries 
/tmp = TeMPorary 
/usr = Unix Shared Resources 
/var = VARiable ? 
FIFO = First In, First Out 
GRUB = GRand Unified Bootloader 
IFS = Internal Field Seperators 
LILO = LInux LOader 
MySQL = My最初作者的名字SQL = Structured Query Language 
PHP = Personal Home Page Tools = PHP Hypertext Preprocessor 
PS = Prompt String 
Perl = "Pratical Extraction and Report Language" = "Pathologically Eclectic Rubbish Lister" 
Python Monty Python's Flying Circus 
Tcl = Tool Command Language 
Tk = ToolKit 
VT = Video Terminal 
YaST = Yet Another Setup Tool 
apache = "a patchy" server 
apt = Advanced Packaging Tool 
ar = archiver 
as = assembler 
bash = Bourne Again SHell 
bc = Basic (Better) Calculator 
bg = BackGround 
cal = CALendar 
cat = CATenate 
cd = Change Directory 
chgrp = CHange GRouP 
chmod = CHange MODe 
chown = CHange OWNer 
chsh = CHange SHell 
cmp = compare 
cobra = Common Object Request Broker Architecture 
comm = common 
cp = CoPy 
cpio = CoPy In and Out 
cpp = C Pre Processor 
cups = Common Unix Printing System 
cvs = Current Version System 
daemon = Disk And Execution MONitor 
dc = Desk Calculator 
dd = Disk Dump 
df = Disk Free 
diff = DIFFerence 
dmesg = diagnostic message 
du = Disk Usage 
ed = editor 
egrep = Extended GREP 
elf = Extensible Linking Format 
elm = ELectronic Mail 
emacs = Editor MACroS 
eval = EVALuate 
ex = EXtended 
exec = EXECute 
fd = file descriptors 
fg = ForeGround 
fgrep = Fixed GREP 
fmt = format 
fsck = File System ChecK 
fstab = FileSystem TABle 
fvwm = F*** Virtual Window Manager 
gawk = GNU AWK 
gpg = GNU Privacy Guard 
groff = GNU troff 
hal = Hardware Abstraction Layer 
joe = Joe's Own Editor 
ksh = Korn SHell 
lame = Lame Ain't an MP3 Encoder 
lex = LEXical analyser 
lisp = LISt Processing = Lots of Irritating Superfluous Parentheses 
ln = LiNk 
lpr = Line PRint 
ls = list 
lsof = LiSt Open Files 
m4 = Macro processor Version 4 
man = MANual pages 
mawk = Mike Brennan's AWK 
mc = Midnight Commander 
mkfs = MaKe FileSystem 
mknod = MaKe NODe 
motd = Message of The Day 
mozilla = MOsaic GodZILLa 
mtab = Mount TABle 
mv = MoVe 
nano = Nano's ANOther editor 
nawk = New AWK 
nl = Number of Lines 
nm = names 
nohup = No HangUP 
nroff = New ROFF 
od = Octal Dump 
passwd = PASSWorD 
pg = pager 
pico = PIne's message COmposition editor 
pine = "Program for Internet News & Email" = "Pine is not Elm" 
ping =  Packet InterNet Grouper 
pirntcap = PRINTer CAPability 
popd = POP Directory 
pr = pre 
printf = PRINT Formatted 
ps = Processes Status 
pty = pseudo tty 
pushd = PUSH Directory 
pwd = Print Working Directory 
rc = runcom = run command, shell 
rev = REVerse 
rm = ReMove 
rn = Read News 
roff = RunOFF 
rpm = RPM Package Manager = RedHat Package Manager 
rsh, rlogin, = Remote 
rxvt = ouR XVT 
sed = Stream EDitor 
seq = SEQuence 
shar = SHell ARchive 
slrn = S-Lang rn 
ssh = Secure SHell 
ssl = Secure Sockets Layer 
stty = Set TTY 
su = Substitute User 
svn = SubVersioN 
tar = Tape ARchive 
tcsh = TENEX C shell 
telnet = TEminaL over Network 
termcap = terminal capability 
terminfo = terminal information 
tr = traslate 
troff = Typesetter new ROFF 
tsort = Topological SORT 
tty = TeleTypewriter 
twm = Tom's Window Manager 
tz = TimeZone 
udev = Userspace DEV 
ulimit = User's LIMIT 
umask = User's MASK 
uniq = UNIQue 
vi = VIsual = Very Inconvenient 
vim = Vi IMproved 
wall = write all 
wc = Word Count 
wine = WINE Is Not an Emulator 
xargs = eXtended ARGuments 
xdm = X Display Manager 
xlfd = X Logical Font Description 
xmms = X Multimedia System 
xrdb = X Resources DataBase 
xwd = X Window Dump 
yacc = yet another compiler compiler

版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/qq_39492932/article/details/101176090
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢