Providing Solutions For Life

Unix cheat sheet

Inspite of years of working on Unix and Linux I still wasn't confident if I knew enough and hence read it in these holidays and I see that we can get our way through these amazing OS using the below commands:-

The OS uses the Filesystem to store data on the harddisk. They are different types of file storage, NTFS, FAT and etc. 

Commands to get your through!

pwd ==> Prints the working directory you are in. 

ls ==> just to list the files and directories, flags
  • -l  => output in list format
  • -a => show the hidden files
  • -h => output is more human, that is easier to understand 
cd ==> Change directory 

find location -type f -name filename   ==> to find the file that you have been looking for.

parted for partitioning ext4

mkfs ==> to create filesystems

echo $PATH  ==> print the path

env ==> to list the environment variables of 

ps -efl  ==> to print the details of the process that are running

ps $$ ==> to get PID of current shell

jobs ==> List background processes

!! ==> to run the last run command

history ==> very important to see what all commands have been run.

sleep 30 ==> to lock the terminal from taking any input for a certain amount of time.

whoami  ==> if you suffer from short term memory loss :) this helps you to know what is the log in you are using currently. 

nohup ==> prefixing it in front of a command makes the process to be immune to any futher signals until the completion of the task. 

& ==> appending this to a command runs it in the background.

fs <job_number> ==> brings the process to foreground.

Global profile (/etc/profile)
User profile (~/.bash_profile)

[million $ question is what is the difference between a job and a process? 
Jobs are one or more processes that are grouped together as a job, where job is a UNIX shell concept.]