✓Linux is one type of operating system.
✓ It is open source platform.
✓ It is a command line interface I.e. we have to use commands to interact with the Linux operating system.
Versions of Linux:
We have different versions of Linux operating system as below,
- RedHat
- Kali
- Slackware
- Debian
- Archlinux
- Solaris
- Ubuntu
- Fedora
✓ To work with the Linux/Unix servers we have to download putty software.
✓ Linux commands are case sensitive.
Basic commands used to deal with linux:
1. pwd( print current working directory):
It prints the current directory name with the complete path.
Command: pwd
2. ls(list):
It gives the list of files present in current directory.
Command: ls -lrt
✓ to display hidden files, use below command.
Command: ls -a
✓ to display the file size in human readable format.
Command: ls -lh
3. cd(change directory):
To move or navigate from one to another directory.
Command: cd directory_name
example: cd /ct-app/logs
4. touch:
To create an Empty file in a directory.
Command: touch file_name
example: touch sample.txt
5. vi:
To edit/ write the content in a file.
Command: vi file_name
Steps :
i. enter the below command to open the file.
command: vi file_name
ii.press "i" from keyboard to enter into insert mode.
iii. write/edit the content in a file
iv. press "esc" button from keyboard to comeout from insert mode.
v. to exit with save,use below command.
command: :wq!
vi. to exit without save, use below command.
command: :q!
6. cat / view :
To view the file, we can use either cat or view command as below.
command: view file_name
command: cat filename
7. rm:
✓To remove the single file from a directory.
command: rm filename
✓ To remove multiple files at a time, use below command.
command: rm filename1, filename2,filename3
8. mkdir:
To create an directory use below command.
command: mkdir directoryname
ex: mkdir Vijay
9. rmdir:
✓ To delete empty directory.
command: rmdir directoryname
✓To remove the directory which contains files.
command: rm -r directoryname
10. To list the java processes running on Linux server.
command : top
11. To check the status of single process ID.
command: ps -ef | grep -i pid
example : ps -ef | grep -i 145
12. mv(move):
To move the file data from one file to another file( data from file1 moved to file2).
command : mv file1 file2
13. cp(copy):
To copy the file data from one file to another file(copies from source(file1) to destination (file2) file).
command: cp file1 file2
14. To search for an specific pattern in a file.
command: grep "vijay" filename
15. To unzip the file in an directory
command: unzip filename.zip
16. To change simulink
command : ln -sfn /ct-app/logs logs
17. To serach for a particular string on linux server using "find" command.
✓The below command search for the string "Vijay" in all the paths on linux server.
command: find . -type f - exec grep -i "Vijay" { } +
18. To know the Java version on Linux server.
command: Java -version
19. To know the Java path which set in batch profile script.
command : vi ~/.bash-profile
20. To unzip tar file in a directory
command: tar -xvf filename.tar
21. To come back one step from the current directory.
command: cd ..
22. To come back two steps from the current directory.
command: cd ../..
23. To kill the pid on a server.
command : kill -9 pid
24. To remove complete line in a file, press letter "d" twice at a time.
command: dd
25. To search for an special characters in an XML file on linux server, use below command.
command: /[^<]
Note:
In your linux server, you don't know from where JRE_HOME path is reading and need to update to latest version.
Solution : Once you login to the server, type below command. You can see JRE_HOME path over there and you can update it and save the changes and close the server and login again. You can see now your JRE_HOME will be pointing to new version.
command : vi ~/.bash_profile
For More Information Click below links here:
- Steps and commands to copy the files from linux server to local system(our laptop)
- Steps and commands to copy the files from one linux to another linux server
- Basic linux script to call Java code from linux server.