Misc. Commands' Cheatsheet
Here's a concise cheatsheet for some miscellaneous commands used in Linux.
We'll cover the following...
Command | Definition | Syntax | Example |
---|---|---|---|
bc | bc is an arbitrary-precision language for performing math calculations. |
bc [ -hlwsqv ] [long-options] [file] |
To assign the variable var a value of 5 and display in on the console: echo "var=5;var" | bc |
chdir (change directory) | chdir is the system command for changing the current working directory. |
chdir direectory_name |
To change directory to “/home/etc/ww”: chdir /home/etc/ww |
df (disk free) | It reports the amount of space used and available on currently mounted filesystems. | df [option(s)] [device(s)] |
To get information only for the root directory: df / |
du (disk usage) | It shows the sizes of directories and files. | du [options] [directories and/or files] |
This will show the sizes of all directories that are in dir2 that resides in dir1: du dir1/dir2 |
file | This command classifies filesystem objects. | file [option(s)] object_name(s) |
Information about a file named “file1.txt” can be obtained by: file file1.txt |
free | It provides information about unused and used memory and swap space. | free [options] |
To show all of the data in megabytes: free -m |
gzip |