Tuesday, 6 September 2016

Basic linux commands

Linux :- Its est open source operating system available in outside world. I has many file systems like ext4 etc unlikely to windows(FAT32/NTFS)

. -> Represents current directory in Linux
.. -> Represents parent directory


killall - Will force fully kill the application with no traces left. 'An instance of firefox is already open' is a real time example to use the command(Usage- killall thunar)- In this command i am closing file manager.

ls - Will list all files in current directory(Usage- ls) in addition to it 'ls -r' lists all sub directories also.'ls -all' displays the permissions also. 'ls -a' to see all hidden files.

touch - will create files (Usage - touch file1.txt file2.txt) - creates two files. If you want to create one file then you can use graphical console else you need to created many files then 'touch' is the best command.When you touch files it will change the timestamp of files which is very helpful for backup files.

which - this command is used to find where does the current installed application is.(Usage- which google-chrome)

ping- To check whether a particular site is reachable from your system(Usage - ping www.google.com -c 3)

cat - It opens up text files to view the information in it(Usage - cat /etc/fstbs). If the file is very big file this command might not be appropriate. Advanced usage  - cat /etc/fstbs | more.'cat > test.text' will provide a provision to add more or edit the file. 'cat file1 file2 > file3' to form a new file 'file3'.

less - More advanced command compared to above where there are many privileges for page navigation.(Usage - less /etc/fstbs)

blkid - Lists all drives (Usage - sudo blkid)

su - simulate the login as other user (Usage - su krishna)- will log me into krishna machine. By typing exit you can logout.This provides an alternative way of 'switching users' via GUI.

reboot - It wil restart the system (Usage - su reboot)

shutdown - Will shutdown the system (Usage - su shutdown -h 15)- It will shutdown the machine after 15 mins, 'su shutdown -c' will ignore the previous command if you change your mind regarding shutdown.

cd - change directory.

date - displays current date (Usage - date)

cal - current month calendar(Usage - cal 2015) - displays full 2015 calendar

uptime - will display how many user ave logged in currently (Usage - uptime)

w - provides who all have been logged in (Usage - w)

whoami - displays which user is currently logged into the terminal (Usage - whoami)

uname -a - displays kernel information (Usage - uname -a)

mkdir - to create directory (Usage - mkdir vfx)

pwd - displays what is your current directory. So that you can navigate to required directory.

ifconfig - Displays current ip information

mv - to move the file to a different directory (Usage - mv filename directoryName). This can be used for rename also (Usage - mv oldfFileName newFIleName)

cp - copy file to a different directory (Usage - cp filename directoryName)

rm - Is used to remove directory

rm -r - This command is used to remove directory (Usage - rm -r directoryName)

man - manual which provides help to construct the command (Usage - man mv)

top - Display the processes similar to task manager. (Usage - top)

history - Displays all previously entered commands (Usage - history)













No comments:

Post a Comment

Custom single threaded java server

 package com.diffengine.csv; import java.io.*; import java.net.*; import java.util.Date; public class Server { public static void main(Str...