Some notes about the fundamentals of using a Unix system, mainly helpful for server maintenance and those kinds of things.read more
How to use Grep (thanks to Kevin):
grep “string to search” *
“ls -a” displays hidden files too
For displaying last lines of file, use “tail -x main.log” where x is a number
For directing output, you can use >. Default, it’ll use standard output which is printing to screen, but you could use “> filename.txt” to redirect the output of something to a file. Same with “<“ and standard input, so you could feed a command, like “sort”, a file by typing “sort < filename.txt”.
The command “Who” tells you who else is currently on the system.
Use pipes to link output to input. So you would could use something like cat file1 | sort > sortedList.txt to create a new file sortedList that has the content of file1 but sorted.
“ls -l” lists everything out with good details.
typing “ps” lists all the processes that are running
Putting an “&” at the end of a line when you run a program, makes it run in the background.
using “file *” reports everything in the directory and its file type
the command “history” lists everything that’s been entered
running ./configure in a newly downloaded package configures the program for your system.
Type make to compile a package, then make install to install the package. Then you could type make clean.
if you have a tar.gz file, then you first have to uncompress it with “gunzip”, then extract the content with “tar -xvf”. Then you should just be able to go to the directory where it was uncompressed and then figure out where you want to install it, and then run ./configure in the directory. Then type “make”, then make check, then make install.
Environmental variables are all caps and start with dollar sign, like $USER or $HOME. Set at login.
Shell variables are variables that apply only to a single shell session.
Use !gcc to execute the last gcc command.