Unix and perl primer for Biologists - Part1 : Unix - Learning the Essentials - Reading Notes(U1-U12)

2023-10-27

Introduction to Unix
Unix contains many hundred of commands but you will probably use just 10 or so to achieve most of what you want to do.

U1. The Terminal
A ‘terminal’ is the common name for the program that does two main things. It allows you to type input to the computer (i.e. run programs, move/view files etc.) and it allows you to see output from those programs.
Task U1.1
There will be many situations where it will be useful to have multiple terminals open and it will be a matter of preference as to whether you want to have multiple windows, or one window with multiple tabs (there are keyboard
shortcuts for switching between windows, or moving between tabs).
U2. Your first Unix command
Unix keeps files arranged in a hierarchical structure.It’s important to note that you will always be “in” a directory when using the terminal. The default behavior is that when you open a new terminal you start in your own ’home” directory (containing files and directories that only you can modify).

ls command
terminal_ls
Four things noted :
1.different outputs depending on your computer
2. Unix command prompt: root@kali:~#
3. directories or files
4. it produces a new command prompt
The ls command is used to list the contents of any directory, not necessarily the one that you are currently in.
ls /boot

U3 : The Unix tree
A tree analogy is often used when describing computer filesystems.When you log in to a computer you are working with your files in your home directory, and this will nearly always be inside a ‘Users’ directory. On many computers there will be multiple users.
U4: Finding out where you are
pwd will Print the Working Directory and that’s pretty much all this command does:
print work directory
The first forward slash that appears in a list of directory names always refers to the top level directory of the file system (known as the root directory). The remaining forward slash (between ‘users’ and ‘clmuser’) delimits the various parts of the directory hierarchy.

U5: Getting from ‘A’ to ‘B’
To change directories, we use the cd command:
to change directory

U6: Root is the root of all evil
When you specify a directory that starts with a forward slash, you are referring to a directory that should exist one level below the root level of the computer.

U7: Up, up, and away
Two dots .. are used in Unix to refer to the parent directory of wherever you are. Use two sets of the .. operator, separated by a forward slash,to navigate up two levels in the file system in one go:
parent_directory

U8: I’m absolutely sure that this is all relative
change to a directory based on its absolute location. Sometimes it is quicker to change directories using the relative path, and other times it will be quicker to use the absolute path.
relative and absolute directory

U9: Time to go home
Unix uses the tilde character as a short-hand way of specifying a home directory.
home_and_root_directory

U10: Making the ls command more useful
Command-line options in Unix are specified by using a dash (‘-’) after the command name followed by various letters, numbers, or words.

ls_longer_output

Task U10.1
ls -R “Recursion”, 递归列出目录文件
ls_l_t_r
ls_lh

U11: Man your battle stations!
Unix command has an associated ‘manual’ that you can access by using the man command.

man ls
man cd
man man

When you are using the man command, press space to scroll down a page, b to go back a page, or q to quit. You can also use the up and down arrows to scroll a line at a time.

U12: Make directories, not war
make a directory
make_new_directory_mono_poly

Task U12.1
Practice creating some directories and navigating between them using the cd command. Try changing directories using both the absolute as well as the relative path (see section U8).
make_directories_and_change_directories_absolute_and_relative

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Unix and perl primer for Biologists - Part1 : Unix - Learning the Essentials - Reading Notes(U1-U12) 的相关文章

  • 如何通过 shell 脚本确定网页是否存在?

    我正在尝试制作一个程序 可以将一系列漫画扫描转换为一个 pdf 文件 并且我不想尝试下载图片来确定我是否有正确的网址 是否有一个 shell 脚本命令可以用来检查网页是否存在 在 NIX 下 您可以使用curl发出一个简单的HEAD要求 H
  • 如何使用 UNIX shell 计算字母在文本文件中出现的次数?

    我有几个文本文件 我想计算每个字母在每个文件中出现的次数 具体来说 我想使用 UNIX shell 来执行此操作 形式为 cat file 做东西 有没有办法让 wc 命令来执行此操作 grep char o filename wc l
  • 如何在 shell 脚本中操作 $PATH 元素?

    有没有一种惯用的方法从类似 PATH 的 shell 变量中删除元素 这就是我想要的 PATH home joe bin usr local bin usr bin bin path to app bin and remove or rep
  • UNIX系统调用监视器

    如何监控进程的系统调用 Check strace http linux die net man 1 strace 在最简单的情况下 strace 运行指定的命令直到退出 它拦截并记录进程调用的系统调用以及进程接收的信号 每个系统调用的名称
  • 如何有效截断文件头?

    大家都知道truncate file size 函数 通过截断文件尾部将文件大小更改为给定大小 但是如何做同样的事情 只截断文件的尾部和头部呢 通常 您必须重写整个文件 最简单的方法是跳过前几个字节 将其他所有内容复制到临时文件中 并在完成
  • awk/Unix 分组依据

    有这个文本文件 name age joe 42 jim 20 bob 15 mike 24 mike 15 mike 54 bob 21 试图得到这个 计数 joe 1 jim 1 bob 2 mike 3 Thanks awk F NR
  • 在两次之间每分钟执行一次 Cronjob

    我需要在 crontab 中每分钟运行一个 bash 脚本8 45am and 9 50am每天的 Code 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 8 home pull sh gt ho
  • 在退出脚本之前等待后台进程完成

    在退出脚本 TCL Bash 之前 如何确保所有后台进程已完成执行 我正在考虑将所有后台进程 pid 写入 pid 文件 然后最后 pgrep pidfile 以查看在退出之前是否有任何进程仍在运行 有一些更简单的方法可以做到这一点吗 TC
  • C# 中的 Unix 套接字

    我正在尝试使用 Mono 的 UnixEndPoint 但在使用它之前就失败了 我在 64 位 Windows 7 系统上运行 Xamarind net 4 5 下面是一些代码 证明单一组合不起作用 foreach SocketType s
  • 检查 Unix 消息队列是否为空

    谁能告诉我如何检查消息队列中是否有消息 消息队列是在基于Linux的操作系统中用C语言实现的 我只是想检查在特定时间消息队列中是否有消息 只需使用以下命令即可检查消息数量 如果有 msgctl 函数 并在返回时检查 msqid ds 结构
  • 如何在gnuplot中将字符串转换为数字

    有没有办法将表示数字 以科学格式 的字符串转换为 gnuplot 中的数字 IE stringnumber 1 0e0 number myconvert stringnumber plot 1 1 number 我可能使用 shell 命令
  • .zip 压缩内部是否维护校验和?

    zip 存档内部是否维护其中文件的校验和 如果它维护校验和 我如何确定校验和在解压过程中得到验证 是否可以在不解压的情况下验证校验和 是的 zip 保存存档中每个文件的 CRC 32 校验和 并且应该在解压缩过程中对其进行验证
  • XAMPP Windows 上的 Php Cron 作业

    嗯 我是这个词的新手CRON 据我所知 这是一个Unix安排特定操作在定义的时间间隔后执行的概念 我需要运行一个php文件 每小时更新一次数据库 但我的困惑在于安排执行 我在用XAMPP用于 Windows 7 上的本地开发测试 我发现了什
  • 安装SIGTSTP前台进程

    我正在尝试为正在运行的前台进程安装 CTRL Z SIGTSTP 处理程序 我设置了处理程序 sigaction 就在我之前wait在父级中 这是正确的地方吗 好像不太好用 EDIT 我正在写一个外壳 这是我的代码的概要 我目前在父级中设置
  • mongodb 正在运行吗?

    我已经在我的 Unix 服务器上安装了 Mongodb 和 PHP 驱动程序 我的问题是如何判断 Mongodb 是否正在运行 是否有一个简单的命令行查询来检查状态 如果我从外壳程序启动一次 如果我退出外壳程序 它会继续运行 情况似乎并非如
  • 如何将命令输出作为多个参数传递给另一个命令

    我想将命令的每个输出作为多个参数传递给第二个命令 例如 grep pattern input returns file1 file2 file3 我想复制这些输出 例如 cp file1 file1 bac cp file2 file2 b
  • 如何从 Unix 命令行递归解压目录及其子目录中的档案?

    The unzip命令没有递归解压缩档案的选项 如果我有以下目录结构和档案 Mother Loving zip Scurvy Sea Dogs zip Scurvy Cures Limes zip 我想将所有档案解压缩到与每个档案同名的目录
  • SIGHUP 用于重新加载配置

    根据signal 7 SIGHUP用于检测控制终端的挂起或控制进程的死亡 然而 我遇到过很多 OSS 守护进程 服务 其中SIGHUP用于启动配置的重新加载 这里有一些例子 hostapd sshd snort etc 这是实现重新加载的标
  • 重新链接匿名(未链接但打开)文件

    在 Unix 中 可以创建匿名文件的句柄 例如 使用 creat 创建并打开它 然后使用 unlink 删除目录链接 留下一个带有 inode 和存储的文件 但没有可能的方法重新打开它 此类文件通常用作临时文件 通常这就是 tmpfile
  • shell脚本中是否有互斥/信号量机制?

    我正在 shell 脚本中寻找互斥 信号量 并发机制 考虑以下情况 除非 a 用户不关闭共享文件 否则 b 用户应该无法打开 更新它 我只是想知道如何在 shell 脚本中实现互斥量 信号量 临界区等 在 shell 脚本中实现锁定机制 文

随机推荐