对计算机的学生而言,许多开发工具是未来老师或企业默认你已经“精通”的,然而未经学校系统培训的我们或许会对此感到迷茫,正如 MIT 课程 The Missing Semester of Your CS Education 所强调的: “掌握基础工具是程序员的核心竞争力”。这个课程会帮助你入门、了解一些计算机常用的开发工具,也算是程序员的自我修养吧!Let’s Go!😄
richard@richard-VMware-Virtual-Platform:~$ cd /home richard@richard-VMware-Virtual-Platform:/home$
cd(Change Directory)表示更改当前目录
这是更方便切换目录的方式:
.表示当前目录
..表示父目录
注意:使用相对路径能提高命令在不同电脑上的兼容性!
1 2 3 4 5 6 7
richard@richard-VMware-Virtual-Platform:/$ ls bin home mnt sbin.usr-is-merged usr bin.usr-is-merged lib opt snap var boot lib64 proc srv cdrom lib.usr-is-merged root swap.img dev lost+found run sys etc media sbin tmp
ls会列出当前目录中的文件,这能够快速浏览文件
1 2
richard@richard-VMware-Virtual-Platform:/home$ cd ~ richard@richard-VMware-Virtual-Platform:~$
cd ~能够快速回到用户主目录
cd -切换到上一个工作目录
1 2 3 4
richard@richard-VMware-Virtual-Platform:~$ ls --help Usage: ls [OPTION]... [FILE]... List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
--help参数显示命令帮助信息
1 2 3 4 5 6 7 8
richard@richard-VMware-Virtual-Platform:~$ ls -l total 40 drwxr-xr-x 2 richard richard 4096 Mar 9 10:21 Desktop drwxr-xr-x 2 richard richard 4096 Mar 9 10:21 Documents
richard@richard-VMware-Virtual-Platform:~$ ls > hello.txt richard@richard-VMware-Virtual-Platform:~$ cat hello.txt Desktop Documents Downloads fizzbuzz.py hello2.txt hello.txt Music Pictures Public snap Templates Videos web
richard@richard-VMware-Virtual-Platform:/sys/class/backlight$ sudo su [sudo] password for richard: root@richard-VMware-Virtual-Platform:/sys/class/backlight#
richard@richard-VMware-Virtual-Platform:~$ false || echo"Oops fail" Oops fail richard@richard-VMware-Virtual-Platform:~$ true || echo"Will be not be printed" richard@richard-VMware-Virtual-Platform:~$
shell中||同样遵循短路原则,&&同理!
1 2
richard@richard-VMware-Virtual-Platform:~$ echo"We are now at $(pwd)" We are now at /home/richard
shell中使用$(command)进行命令替换
1 2 3 4 5
richard@richard-VMware-Virtual-Platform:~$ ls Desktop Downloads hello.txt Pictures snap Videos Documents hello2.txt Music Public Templates web richard@richard-VMware-Virtual-Platform:~$ ls *.txt hello2.txt hello.txt
NAME FRIENDLY NAME Ubuntu Ubuntu Ubuntu-24.04 Ubuntu 24.04 LTS openSUSE-Tumbleweed openSUSE Tumbleweed openSUSE-Leap-16.0 openSUSE Leap 16.0 SUSE-Linux-Enterprise-15-SP7 SUSE Linux Enterprise 15 SP7 SUSE-Linux-Enterprise-16.0 SUSE Linux Enterprise 16.0 kali-linux Kali Linux Rolling Debian Debian GNU/Linux AlmaLinux-8 AlmaLinux OS 8 AlmaLinux-9 AlmaLinux OS 9 AlmaLinux-Kitten-10 AlmaLinux OS Kitten 10 AlmaLinux-10 AlmaLinux OS 10 archlinux Arch Linux FedoraLinux-43 Fedora Linux 43 FedoraLinux-42 Fedora Linux 42 eLxr eLxr 12.12.0.0 GNU/Linux Ubuntu-20.04 Ubuntu 20.04 LTS Ubuntu-22.04 Ubuntu 22.04 LTS OracleLinux_7_9 Oracle Linux 7.9 OracleLinux_8_10 Oracle Linux 8.10 OracleLinux_9_5 Oracle Linux 9.5 openSUSE-Leap-15.6 openSUSE Leap 15.6 SUSE-Linux-Enterprise-15-SP6 SUSE Linux Enterprise 15 SP6
1 2 3 4 5 6 7 8 9 10 11 12
❯ wsl --install Debian 正在下载: Debian GNU/Linux 正在安装: Debian GNU/Linux 已成功安装分发。可以通过 “wsl.exe -d Debian” 启动它 正在启动 Debian... Please create a default UNIX user account. The username does not need to match your Windows username. For more information visit: https://aka.ms/wslusers Enter new UNIX username: richard New password: Retype new password: passwd: password updated successfully usermod: no changes
1 2 3 4 5
(base) PS C:\Users\Legion> wsl -l -v NAME STATE VERSION * Ubuntu Running 2 Debian Running 2 docker-desktop Stopped 2