g++
Compiles C++ source files. Part of GCC (GNU Compiler Collection).
More information: man g++
Examples
Compile a source code file into an executable binary:
g++ {{path/to/source.cpp}} -o {{path/to/output_executable}}
Display common warnings:
g++ {{path/to/source.cpp}} -Wall -o {{path/to/output_executable}}
Choose a language standard to compile for (C++98/C++11/C++14/C++17):
g++ {{path/to/source.cpp}} -std={{c++98|c++11|c++14|c++17}} -o {{path/to/output_executable}}
Include libraries located at a different path than the source file:
g++ {{path/to/source.cpp}} -o {{path/to/output_executable}} -I{{path/to/header}} -L{{path/to/library}} -l{{library_name}}
Compile and link multiple source code files into an executable binary:
g++ -c {{path/to/source_1.cpp path/to/source_2.cpp ...}} && g++ -o {{path/to/output_executable}} {{path/to/source_1.o path/to/source_2.o ...}}
Display version:
g++ --version
cp
Copy files and directories.
More information: man cp
Examples
Copy a file to another location:
cp {{path/to/source_file.ext}} {{path/to/target_file.ext}}
Copy a file into another directory, keeping the filename:
cp {{path/to/source_file.ext}} {{path/to/target_parent_directory}}
Recursively copy a directory's contents to another location (if the destination exists, the directory is copied inside it):
cp -R {{path/to/source_directory}} {{path/to/target_directory}}
Copy a directory recursively, in verbose mode (shows files as they are copied):
cp -vR {{path/to/source_directory}} {{path/to/target_directory}}
Copy text files to another location, in interactive mode (prompts user before overwriting):
cp -i {{*.txt}} {{path/to/target_directory}}
Make symbolic link instead of copying:
cp -s {{path/to/source_file.ext}} {{path/to/target_file.ext}}
astyle
Source code indenter, formatter, and beautifier for the C, C++, C# and Java programming languages. Upon running, a copy of the original file is created with an ".orig" appended to the original file name.
More information: man astyle
Examples
Apply the default style of 4 spaces per indent and attached braces:
astyle {{source_file}}
Apply the Stroustrup style with attached braces:
astyle --style=stroustrup {{path/to/file}}
Apply the Allman style with broken braces:
astyle --style=allman {{path/to/file}}
passwd
Passwd is a tool used to change a user's password.
More information: man passwd
Examples
Change the password of the current user interactively:
passwd
Get the current status of the user:
passwd -S