what is linux dash

藏色散人
Release: 2023-04-13 11:05:18
Original
1409 people have browsed it

linux dash is a lightweight Linux distribution system resource monitoring tool. There are many additional functions in this tool that are not found in the system's default system monitor; you can Install, configure and use the Linux Dash tool on the system and monitor parameters through the web browser interface.

what is linux dash

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

What is linux dash?

Linux Dash is a simple, powerful, lightweight Linux distribution system resource monitoring tool. You can install, configure, and use the Linux Dash tool on your system and monitor parameters through a web browser interface. It is better to use Linux Dash as it is very lightweight and there are many extra features in this tool that are not found in the default system monitor of your system. Additionally, some lightweight Linux distributions do not come with pre-installed GUI system monitoring tools, and Linux Dash will help them a lot. Installing and using Linux Dash is a simple process that does not require any programming skills.

Extended introduction:

The difference between Ubuntu’s bash and dash

What is bash?

Bash (GNU Bourne-Again Shell) is the default shell for many Linux platforms. In fact, there are many shells used on traditional UNIX, such as tcsh, csh, ash, bsh, ksh, etc.

/bin/sh in the GNU/Linux operating system was originally a symbolic link to bash (Bourne-Again Shell), but in view of bash being too complex, someone transplanted bash from NetBSD to Linux and renamed it dash (Debian Almquist Shell) and recommend pointing /bin/sh to it for faster script execution. Dash Shell is much smaller than Bash Shell and complies with POSIX standards.

In Debian and Ubuntu, /bin/sh has pointed to dash by default. This is a shell different from bash. It mainly appears for executing scripts rather than interacting. It is faster but has the same functions. Much less than bash, the syntax strictly adheres to POSIX standards.

It is this unlucky dash interpreter that prevents the shell script I wrote according to bash syntax from running.

To know which interpreter your /bin/sh points to, you can use the ls /bin/sh -al command to check:

   $ ls /bin/sh -al
   lrwxrwxrwx 1 root root 4 11月 16 15:33 /bin/sh -> bash
Copy after login

The above result means that the current system uses the dash interpretation device.

The way to switch to bash is actually quite simple. The key is that I have never found out the reason...

To modify the default sh, you can use the command sudo dpkg-reconfigure dash

A picture-like configuration menu will appear, just select no

Check again, ls /bin/sh -al found that the soft link points to /bin/bash

 lrwxrwxrwx 1 root root 4 11月 16 15:33 /bin/sh -> bash
Copy after login

Note: dash The main differences in syntax with bash are:

1.定义函数
bash: function在bash中为关键字
dash: dash中没有function这个关键字
2.select var in list; do command; done
bash:支持
dash:不支持, 替代方法:采用while+read+case来实现
3. echo {0..10}
bash:支持{n..m}展开
dash:不支持,替代方法, 采用seq外部命令
4. here string
bash:支持here string
dash:不支持, 替代方法:可采用here documents
5. >&word重定向标准输出和标准错误
bash: 当word为非数字时,>&word变成重定向标准错误和标准输出到文件word
dash: >&word, word不支持非数字, 替代方法: >word 2>&1; 常见用法 >/dev/null 2>&1
6. 数组
bash: 支持数组, bash4支持关联数组
dash: 不支持数组,替代方法, 采用变量名+序号来实现类似的效果
7. 子字符串扩展
bash: 支持${parameter:offset:length},${parameter:offset}
dash: 不支持, 替代方法:采用expr或cut外部命令代替
8. 大小写转换
bash: 支持${parameter^pattern},${parameter^^pattern},${parameter,pattern},${parameter,,pattern}
dash: 不支持,替代方法:采用tr/sed/awk等外部命令转换
9. 进程替换<(command), >(command)
bash: 支持进程替换
dash: 不支持, 替代方法, 通过临时文件中转
10. [ string1 = string2 ] 和 [ string1 == string2 ]
bash: 支持两者
dash: 只支持=
11. [[ 加强版test
bash: 支持[[ ]], 可实现正则匹配等强大功能
dash: 不支持[[ ]], 替代方法,采用外部命令
12. for (( expr1 ; expr2 ; expr3 )) ; do list ; done
bash: 支持C语言格式的for循环
dash: 不支持该格式的for, 替代方法,用while+$((expression))实现
13. let命令和((expression))
bash: 有内置命令let, 也支持((expression))方式
dash: 不支持,替代方法,采用$((expression))或者外部命令做计算
14. $((expression))
bash: 支持id++,id--,++id,--id这样到表达式
dash: 不支持++,--, 替代方法:id+=1,id-=1, id=id+1,id=id-1
Copy after login

Recommended study: "linux video tutorial"

The above is the detailed content of what is linux dash. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template