导入
预备知识:Linux 文件结构与命令
查看 Linux 中的文件组织结构以及一些基本的命令行界面(CLI)命令。
代码示例
1ls # 列出当前目录下的所有文件和文件夹 2ls usercode # 列出 "usercode" 目录下的所有文件和文件夹
切换到指定目录
1cd usercode # 切换到 usercode 目录
在终端中查看文本文件的内容
1cat example.txt # 文件名 2cat usercode/files/example.txt # 文件路径
在命令行中执行 Ruby 代码
1ruby main.rb
1cd usercode/files 2cd .. 3ruby ./main.rb
Terminal
main.rb && mkdir files && cd files && echo "You are viewing the content of file 'example.txt'" >> example.txt && cd ../.. && clear" mode="edit">