Check how long server has been running
Answer:
Use the uptime command
$ uptime
22:36:10 up 12 min, 1 user, load average: 0.00, 0.04, 0.06
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Check how long server has been running
Answer:
Use the uptime command
$ uptime
22:36:10 up 12 min, 1 user, load average: 0.00, 0.04, 0.06
How to change the login shell?
Answer:
To change the current user login shell, use the following command
e.g. change to /bin/sh
chsh -s /bin/sh
Logout and login again.
How to clear the screen in Linux
Answer:
Use the clear command
# clear
Convert DOS newlines to Unix format
Answer:
To convert DOS newlines (CR/LF) to Unix (LF only), use sed, which can be found on most platforms.
sed "s/\r//" input.txt > output.txt
How to replace a string in a file using Perl
Answer:
Assume you have a file "test'txt", contains the string "abc", and you want to replace by "def", use the following script
perl -pi -e "s/abc/def/g;" test.txt