0% found this document useful (0 votes)
2 views1 page

Essential Linux Command-Line Guide

This document provides a quick reference for common Linux command line tasks like navigating directories, compiling and running code, input/output redirection, and timing/verifying code. It outlines commands for changing directories, compiling C++ code with g++, running programs with input/output files using < and >, timing code execution, and comparing output files with diff.

Uploaded by

Kent Nguyen
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Essential Linux Command-Line Guide

This document provides a quick reference for common Linux command line tasks like navigating directories, compiling and running code, input/output redirection, and timing/verifying code. It outlines commands for changing directories, compiling C++ code with g++, running programs with input/output files using < and >, timing code execution, and comparing output files with diff.

Uploaded by

Kent Nguyen
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Quick Linux Reference for the command-line

Directory navigation
Change the current directory to the desktop cd ~/Desktop Going up one directory cd ../ Going to a folder named folder in the current path cd folder

Compiling and running code


Compiling [Link] into an executable named code g++ -O2 -o code [Link] Running code ./code

Running code with input and output files


Running code with [Link] as the input file ./code < [Link] Running code with [Link] as the input file and writing the output to out ./code < [Link] > out Printing the contents of out cat out

Timing and verifying code


Running code with [Link] as the input file, and timing its execution time ./code < [Link] Running code with [Link] as the input file and writing the output to out, and timing its execution time ./code < [Link] > out Print all differences between [Link] and out diff [Link] out

You might also like