The command: gcc -Wall -Wextra -O2 -g -o program program.c
compiles the C source code located inside the file program.c and created an executable (= binary) file called program. The command gcc invokes the GNU C Compiler. Above, if we were to omit "-o program" from the command ("o" is the lowercase "Ohh" letter,) the executable's name would be the generic name "a.out". The command options "-Wall" and "-Wextra" let the compiler display all the basic and extra possible compilation warnings to alert the user that a certain part of the program might not execute as intended in case of a warning showing up after running the command. The option "-O2" ("O" is the uppercase "Ohh" letter) sets the optimization level to 2 (= significant but sane) out of 5 possible optimization levels. Finally, the option "-g" allows the user to run the C debugger program, gdb, after the compilation in case debugging or program tracing is needed.
Example: The command gcc -Wall -Wextra -O2 -g -o hello helloworld.c will compile the source code file helloworld.c and produce a binary file named hello that you can run on the computer. You would run it in the following way: you would type ./hello into the terminal and then press ENTER/RETURN for the program to run. Programs might prints messages to the terminal, such as Hello World!.
The command: . ./.short_prompt
executes code inside a file named .short_prompt and sources it (lets the changes indicated by the code take effect by the command line interpreter.)
On my device, I put the following 2 lines of code into this file: PS1="\[\033[0;32m\]\$ \[\033[0;37m\]" echo "Prompt Updated!"
This code changes the terminal prompt to only: "$ ", so that longer commands that we type in the terminal will most likely fit into a single line on the screen.
Once you create this file, make it executable by running the following command in the terminal: chmod u+x .short_prompt
Finally, you would run this command by either typing: . ./.short_prompt
or source ./.short_prompt
into the terminal. Otherwise, if you just type: ./.short_prompt, the change indicated by the code (changing the length of the command prompt) won't take effect in the terminal, and you'll keep seeting your old prompt.
The change made by the code in .short_prompt is good only for the duration of the current login session into the terminal; once you log out and log back in, you'll see your original, old prompt as before the change by .short_prompt.
The command: . ./.long_prompt
behaves similarly to . ./.short_prompt, except that you can put code into .long_prompt that will make the prompt 'fancier' than just "$ ". On my device, .long_prompt contains the following code: magenta=$(tput setaf 5) green=$(tput setaf 2) reset=$(tput setaf 7) # White color PS1='\[$magenta\][\D{%a %d/%m/%Y, %H:%M:%S}]\[$green\] \u@\h:\w\$ \[$reset\]' echo "Prompt Updated!"
The command: ls -i
shows the i-node number of every file and folder inside the current folder.
The command: ls -i *
shows the i-node number of every file inside the current folder, including those files within nested folders.
The command: ln file1 hardlinkForFile1
creates a hard link for file1. The name of the hard link is hardlinkForFile1. Once this command executes, two files will reside inside the current directory: file1 and hardlinkForFile1 (besides all the other files in the directory.) These two files point at the exact same file. If the contents of the file are changed, this change will be reflected once you access either of file1 or hardlinkForFile1.
Example: The command ln message.txt linkMessage.txt will create a hard link for message.txt called linkMessage.txt. Both files point at the exact same content: only one file is stored on the disk, but there are two ways of accessing its content (either by opening message.txt, or by opening linkMessage.txt.)
The command: ln -s file1 softlinkForFile1
creates a soft (= symbolic) link for file1. The name of the link is softlinkForFile1.
One difference between a hard and a soft link is that, when the file that has a soft link is deleted, the soft link still remains on the computer, and turns into what we usually call a 'broken link'. Conversely, if you delete a file that has a hard link, both the file and the hard link are deleted from the device.