To check the login activity on a Unix server you can run the following command:
# last | head
'head' just displays the last 10 logins.
You can also check the login activity of a specific user:
# last user_name | head
Wednesday, September 16, 2009
Total Memory Installed on Solaris
Use the prtconf command to get the total amount of memory installed on a Solaris machine:
# prtconf
# prtconf
Tuesday, September 15, 2009
Counting the number of occurrences of each line in a file
To count the number of occurrences of each line in Linux you can use the following command:
sort input_file | uniq -c > output_file
You may want to ignore the case and then apply the count:
cat input_file | tr '[:upper:]' '[:lower:]' | sort | uniq -c > output_file
sort input_file | uniq -c > output_file
You may want to ignore the case and then apply the count:
cat input_file | tr '[:upper:]' '[:lower:]' | sort | uniq -c > output_file
Monday, September 7, 2009
Removing punctuation from a file in Linux
To remove the punctuation from a file run the following command:
cat input_file | tr -d '[:punct:]' > output_file
cat input_file | tr -d '[:punct:]' > output_file
Converting all Upper Case letters to Lower Case in Linux
To convert all upper case characters to lower case in Linux, run the following command:
cat input_file | tr '[:upper:]' '[:lower:]' > output_file
cat input_file | tr '[:upper:]' '[:lower:]' > output_file
Subscribe to:
Posts (Atom)