Hello Techie's,
If you are working for the client whose operating system is linux, Then you are in the Right place. Take a note of the below commands and use it when the time comes and impress your colleague and Manager.
1. How to List specific lines from the file contains large Data ?
If a file contains many lines and If you want to display lines from 800 to 900, you can use the above command.we can adjust the values which we are giving with head and tail commands based on our requirement.
Command:
cat filename | head -900 | tail -100
Output:
2. How to Perform HouseKeeping in the linux server ?
If your manager gives you task to Delete the unwanted files present in the disk. As a first Step you need to check if any of the filesystem disk used percent is exceeding 85%, then you need to navigate into that filesystem and find large files present in the folders.In the example command, I have listed top 20 large files present in the vagrant filesystem, If you want just top 5 largefile then adjust the command to head -5
Command:
df -h
du -amh | sort -n -r | head -20
Output:
3. How to Perform Sanity check in linux servers ?
lets say, your manager called you on the sunday evening and told you that unix Team has performed patching and rebooted in the server. As you are weekend Standby person on that week you need login the server and check the sanity of the server and give the report to your Manager. Not to worry, we got you covered..!
Command:
date
hostname
nslookup
ping
ps -ef
unifstat
Output:
4. how to print empty line in a file?
If you want to find the empty lines in file, you can use the below command.
Command:
grep -n '^$' filename
sed -n '/^$/p' filename
Output:
5. how to remove empty line in a file ?
If a file is large and you just want to remove the Empty lines in that file. you can use the below command.
Command:
sed '/^$/d' filename
Output:
Comments
Post a Comment