Regarding LINUX

LINUX (LINUX not UNIX) is a operating system which is available freely in different distributions .such as,

  1. Ubuntu
  2. fedora
  3. Kali LINUX
  4. Debian etc.,

similar to 'command prompt' in WINDOWS operating system we have  'terminal' in LINUX.

How to install LINUX into system.

1.Using virtual box:
  1. install VM ware
  2. download the iso image file of any of the above mentioned LINUX distributions.
  3. open VM Ware select new and procced with the user friendly installation procedure.
2.Dual Booting:
  1. copy the downloaded image file to DVD or pendrive.
  2. make the drive bootable by using softwares like Nero
  3. insert bootable drive into USB port of the system and restart the computer .
  4. select Boot from USB drive.
  5. follow the installation procedures to completely install the LINUX operating system in your system.
Note: every time you restart your computer it will ask for Windows or Linux (e.g., Ubuntu).

3.In WINDOWS-10 ;
here there is a windows subsystem for LINUX(WSL). follow the below given instructions to enable this feature in WINDOWS 10.
  1. go to settings->update and security->for developers.
  2.  and set your system in developer mode.
  3.  go to Control Panel\Programs\Programs and Features->turn widows features on or of
  4. check windows subsystem for LINUX
  5. now type bash on ubuntu in search bar and select the ubuntu icon.
  6. follow all installation proceures to install CLI (command line interface) of lINUX.
Basic commands of LINUX terminal:

  1. cd    ->to change directoory.
  2. mkdir   -> to create directory.
  3. mv   -> to renmae
  4. touch    ->to create file.
  5. cat [file]    ->to get content of file or files.
  6. cp    ->to copy information from one file to another file.
  7. ls   -> listing.
  8. ls -l    ->long listing.
  9. ls -a  ->  to list all files.
  10. man [command]    ->display manual for the use of command.
  11. chmod   -> to change file permissions.
  12. time   -> to display current time.
  13. cal    ->to display calender.
  14. banner [text]   -> to display banner.
  15. rd    ->to remove directory or file.
  16. rd -r    ->for recursive removal.
  17. grep   -> to get regular expression of the word.
  18. pwd   -> prints present working directory.
  19. history  ->  list out previous thousand commands we typed.
  20. sudo apt-get install [package]    ->to install any package.
  21. geedit   -> to open text editor.
  22. vi or vim    ->to open text editor inside the terminal.
  23. cd ..   -> to move one directory back.
  24. cd /   -> to move to root directory.
  25. echo    ->to echo wehatever we type.
  26. sudo apt list --installed    -> lists all installed packages
  27. sudo apt list --installed | less
  28. sudo apt list --installed | grep -i pkgnamee -> to see particular package
  29. sudo dpkg -l    -> to list all packages
  30. sudo dpkg -l | grep -i pkgname
  31. sudo apt-get remove <application_name>    -> to uninstall a package
  32. sudo service pkgname stop
  33. sudo dpkg-reconfigure pkgname
  34. apt-cache search keyword  ->show package for installing
  35. apt-cache pkgnames pkgname    ->lists all related packages to be installed
  36. apt-cache show pkgname    -> show package for installing
  37. apt-cache showpkg pkgname    -> to see dependencies for package
  38. apt-cache stats
  39. sudo apt-get update
  40. sudo apt-get upgrade
  41. sudo apt-get dist-upgrade
  42. sudo apt-get install nethogs goaccess    -> installing multiple packages at once
  43. sudo apt-get install '*name*'    ->installing several packages using wildcard
  44. sudo apt-get install packageName --no-upgrade    ->installing packages without upgrading.
  45. sudo apt-get install packageName --only-upgrade    ->upgrading specific package
  46. sudo apt-get install  pkgnme=2.3.5-3ubuntu1    ->installing specific package version.
  47. sudo apt-get purge  pkgnme   ->to completely remove the package
  48. sudo apt-get remove --purge pkgnme ->
  49. sudo apt-get --download-only source vsftpd    ->downloading only sourcecode of the package.
  50. sudo apt-get source vsftpd    ->download and unpack a package to specified directory.
  51. sudo apt-get --compile source goaccess    ->download unpack and compile a package.
  52. sudo apt-get download nethogs    ->download the package without installing.
  53. sudo apt-get changelog vsftpd    -> check and change the log of the package.
  54. sudo apt-get check    -> checks broken dependencies.
  55. sudo apt-get build-dep netcat    ->search  and build dependencies.
  56. sudo apt-get clean    ->to clean disk space.
  57. sudo apt-get autoremove  pkgnme
  58. free -lm    ->to check the memory details.
  59. cat /proc/meminfo   ->to display memory information.
  60. sudo su  ->to login as super user.
NOTE:
  • once in few days ypu update the installed packages by using the command, 
                  sudo apt-get update
  • ulso upgrade the packages to newer versions using the command,
                  sudo apt-get upgrade
  • it is a pretty cool that we can work on many programming languages like, java,perl,C,C++,python by installing the required packages with a simple commands. and some packages like python are inbuilt and no need for further installation.
  • one can also install mysql-server by 'apt-get install ' command.
                             
LINUX/UNIX commands with preference:

FILE COMMANDS:
  1. ls              ->directory listing
  2. ll        ->long listing
  3. ls -al            ->formatted listing with hidden files.
  4. cd dir          ->change directory to dir.
  5. pwd            ->shows present working directory.
  6. mkdir dir    ->create directory dir.
  7. rm file        ->delete file.
  8. rm -r dir    ->delete directory dir.
  9. rm -f file    ->removes file with force.
  10. rm -rf dir    ->force remove directory.
  11. mv file1 file2    ->rename or move file1 to file2 directory file.
  12. cp file1 file2    ->copy file1 to file2.
  13. cp -r dir1 dir2    ->copy dir1 to dir2. if dir2 is not exists it creates.
  14. ln -s file link    ->creates symbolic link to file.
  15. touch file    ->creates or updates file.
  16. cat > file    ->places standard input into file.
  17. more file    ->output the contents of file.
  18. head file    ->output the first 10 lines of the file.
  19. tail -f file    ->output the contents of file as it grows, starting with the last 10 lines.

PROCESS MANAGEMENT:
  1. ps            ->display the currently active process.
  2. top            ->display all running processes.
  3. kill pid     ->kill process id pid.
  4. killall proc    ->kill all processes named proc*
  5. bg        ->lists stopped or background jobs; resumes a stopped job in the background.
  6. fg        ->brings the most recent job to the foreground.
  7. fg n        ->brings job n to the foreground.

FILE PERMISSION:
chmod octal file    -> change permissions of file to octal, which can be found separately for user, group and others.
  •     4-read(r)
  •     2-write(w)
  •     1-execute(x)
e.g.,
  1. chmod 777 file    ->read, write and executable permissions to all thrree.
  2. chmod ugo+x    ->executable permissions to all.
  3. chmod u-x    ->removing executable permission to the user.

SSH:
  1. ssh user@host    ->connect to host as a user.
  2. ssh -p port user@host    ->connect to host on port. port as a user.
  3. ssh-copy-id user@host    ->add your key to host for user to enable a key or host for user to enable a keyed or passwordless login.

SEARCHING:
  1. grep pattern files    ->search for pattern in files.
  2. grep -r pattern dir    ->search recursively for pattern in dir.
  3. command | grep pattern    ->search for the pattern in output of the command.
  4. locate file        ->file all instances of file.

SYSTEM INFORMATION:
  1. date    ->show the current date and time.
  2. cal    ->shows this month's calender.
  3. uptime    ->show current uptime.
  4. w    ->display who is online.
  5. whoami    ->whoyou are logged in as.
  6. figer user    ->display information about user.
  7. uname -a    ->show kernel information.
  8. cat/proc/cpuinfo    ->cpu information.
  9. cat/proc/meminfo    ->memory information.
  10. man command    ->shows manual for the command.
  11. df    ->show disk usage.
  12. free    ->show memory and swap usage.
  13. whereis app    ->show possible locations of app.
  14. which app    ->show which app will be run by default.

COMPRESSION:
  1. tar cf file.tar files    ->create file.tar containing files.
  2. tar xf file.tar    ->extracts the files from file.tar.
  3. tar czf file.tar.gz files    ->creates a tar with Gzip compression.
  4. tar xzf file.tar.gz files    ->extract a tar using Gzip.
  5. tar cjf file.tar.bz2    ->creates a tar with Bzip2 compression.
  6. tar xjf file.tar.bz2    ->extracts tar using Bzip2.
  7. gzip    file    ->compress file and renames it to file.gz
  8. gzip -d file.gz    ->decompresses file.gz back to file.

NETWORK:
  1. ping host    ->ping host and output results.
  2. whois domain    ->get whois information fopr domain.
  3. dig domain    ->get DNS information for domain.
  4. dig -x host    ->reverse look up host
  5. wget    file    ->download file.
  6. wget    -c file    ->continue a stoppe download.

INSTALLATION:
  • ./configure
  • make
  • make install
  1. dpkg -i pkg.deb            ->install package(Debian)
  2. rpm -Uvh pkg.rpm    ->intall a package(RPM)

SHORTCUTS:
  1. ctrl+C    ->halts the current command.
  2. ctrl+z    ->stops the current command,resumes with fg i in foreground and bg in te background.
  3. ctrl+d    ->log out the current session,similar to exit.
  4. ctrl+w    ->erases one word in the current line.
  5. ctrl+u    ->erases whole line.
  6. ctrl+r    ->type to bring up a recent command.
  7. !!    ->repeats the last command.
  8. exit    ->log out current session




Comments