Show hardware information from the BIOS: dmidecodeĭisplay disk data information: hdparm -i /dev/diskĬonduct a read-speed test on device/disk: hdparm -tT /dev/ Show PCI devices in a tree-like diagram: lspci -tvĭisplay USB devices in a tree-like diagram: lsusb -tv See information about block devices: lsblk List hardware configuration information: lshw
Hardware Informationĭisplay free and used memory with: free -h
Zeus’s shenanigans did some good, after all.The commands found in the downloadable cheat sheet are listed below. If it didn’t exist, we’d have to invent it. RELATED: What Are stdin, stdout, and stderr on Linux? That’s echo’s RepertoireĪ simple command, but indispensable. Our logfile is created for us and cat shows us that the datestamp and timestamp were both added to it. echo "Logfile started: $(date +'%D %T')" > logfile.txt cat logfile.txt They prevent the space between the parameters being interpreted as the end of the parameter list. They ensure the parameters are passed to date correctly. Note the single quote marks around the parameters for the date command. If the file is a logfile, we might want to have a timestamp added to it. The cat command displays the contents of the file to the terminal window.Īnd of course, we can include variables to add some useful information to our file. The second command adds a line of text to the bottom of the file. So, try this in the terminal window: date +%DĪnd, satisfied that we’re getting what we expect from the date command, we’ll integrate it into an echo command: echo "Today's date is: $(date +%D)"Ī new file is created by the first command, and text is inserted into it. Then, if the echo command doesn’t do what you expect, you’ll know the issue must be with the echo syntax because you’ve already proven the command’s syntax. That way, if there is something wrong with the syntax of your command, you identify it and correct it before you include it in the echo command. One tip is to use the command on its own before you start using it with echo. We must use the dollar sign $ as though the command was a variable, and wrap the whole command in parentheses. We can use a command with echo and incorporate its output into the string that is written to the terminal window.
RELATED: How to Work with Variables in Bash Using Commands With echo Using double quote marks results in the variable being interpreted-also called variable expansion-and the value is written to the terminal window.Using single quote marks results in the text being written to the terminal window in a literal fashion.echo 'My name is $my_name' echo "My name is $my_name" To have the variable value displayed, and not the name of the variable, use double quote marks. If you’ve wrapped your string in single quote marks echo will treat everything literally.
You must put a dollar sign $ in front of the variable name to let echo know it is a variable. It has been assigned the value of the text “Dave.” We can use the variable name in the strings that we pass to echo , and the value of the variable will be written to the terminal window. A variable called my_name has been created.