Ever wanted to have some basic stats of your projects?
Like:
Code:
./stats.sh
########################################
Project stats for "tui"
########################################
260 kb in bin
24 kb in conf.etc
12 kb in conf.home
32 kb in docs/samples
176 kb in docs/wiki
280 kb in docs
192 kb in man
1984 kb in screenshots
12 kb in templates/manpage
32 kb in templates/scripts
12 kb in templates/usr
64 kb in templates
36 kb in themes
13 folders with a total of 3116 kbytes
########################################
Spread across 190 files, there are:
Lines Total: 14542
Comment lines: 2409
Blank lines: 201
Avrg lines p. file: 76
Was created using these few lines:
Code:
#!/bin/bash
#
# Vars
#
LINER="########################################"
COMMENTS=0
LINES=0
BLANKS=0
#
# Action
#
echo "$LINER"
echo -e "\tProject stats for \"$(basename $PWD)\""
# Size
echo "$LINER"
for DIR in * ; do [ -d "$DIR" ] && LIST+=" $DIR" ; done
du $LIST | awk '{print $1" kb\tin "$2;SUM=SUM+$1} END {print NR" folders with a total of "SUM" kbytes"}'
# Files
echo "$LINER"
FILES=$(find|grep -ve ".git" -ve ".jpg"| wc -l)
echo "Spread across $FILES files, there are:"
# Lines
for F in $(find|grep -ve ".git" -ve ".jpg")
do [ -f "$F" ] && \
COMMENTS=$(( $COMMENTS + $(grep ^"#" "$F" | wc -l) )) && \
LINES=$(( $LINES + $(cat "$F" | wc -l) )) && \
BLANKS=$(( $BLANKS + $(grep ^[[:space:]]$ "$F" | wc -l) ))
done
# Summary
echo -e "Lines Total: \t\t $LINES"
echo -e "Comment lines: \t\t $COMMENTS"
echo -e "Blank lines: \t\t $BLANKS"
echo -e "Avrg lines p. file: \t $(( $LINES / $FILES ))"
I wanted to share it when i wrote it, but figured i didnt.
We have a system running ssh. When a user logs in, they do not get the project they are assigned to (they run under "system"). I verify the project using the command "ps -e -o user,pid,ppid,args,project". If you do a "su - username", the user does get the project they are assigned to (and all... (2 Replies)
i have two doubts..
1. what is the use /etc/project file. i renamed this file and when i tried to switch user or login with some user account the login was happening slowly. but when i renamed it to original name it was working fine... why so?
2. unix already has useradd and grouadd for... (4 Replies)
A new project was posted on your project board.
Project title: Bash Shell Tutoring
Estimated Budget:
$50/hr
Start date:
Immediately
Required skills:
Linux, Bash, Shell, UNIX
I work as a datawarehouse designer and developer.
Although I usually stick to the role of an analyst,... (0 Replies)
I have a project tree like that.
after running find command with the -no -empty option, i am able to have a list of non empty directory
DO_MY_SEARCH="find . -type d -not -empty -print0"
MY_EXCLUDE_DIR1=" -e NOT_IN_USE -e RTMAP -e NOT_USEFULL "
echo " " > $MY_TEMP_RESULT_1
while... (2 Replies)
Discussion started by: jcdole
2 Replies
LEARN ABOUT DEBIAN
battery-stats
BATTERY-STATS(5) File Formats Manual BATTERY-STATS(5)NAME
battery-stats - collected battery statistics
DESCRIPTION
The battery-stats contains statistics about battery charge over time, as collected by the battery-stats-collector (8) daemon.
FORMAT
Each line in the file represents one sample and is of the form:
<seconds> <charge%> <powermode> <UTC-date> <UTC-time>
separated by spaces and terminated by a newline.
Where:
seconds
is the number of seconds since 1st Jan 1970 00:00:00 UTC
charge%
is the battery charge a number between 0 and 100
powermode
indicates the power mode:
0 A/C off
1 On battery
2 On backup power
UTC-date
a human-readable date in the format YYYY/MM/DD. Note that this is in UTC, not the local or system timezone.
UTC-time
a human-readable time in the format HH:MM:SS (using a 24-hour clock). Note that this is in UTC, not the local or system timezone.
minutes-left
is the BIOS estimate of how many minutes of running time the battery would provide. This may be unreliable, depending on the BIOS
through which it was collected.
EXAMPLE
A battery under charge might result in the following samples:
1032651245 27 1 2002/09/21 23:34:05 94
1032651275 28 1 2002/09/21 23:34:35 97
1032651305 29 1 2002/09/21 23:35:05 100
1032651335 30 1 2002/09/21 23:35:35 103
1032651365 30 1 2002/09/21 23:36:05 106
FILES
The default set-up is to save battery statistics in /var/log and rotate the logs weekly, which results in this set of files:
/var/log/battery-stats - current (most recent) statistics
/var/log/battery-stats.[0-9]+ - less recent statistics
/var/log/battery-stats.[0-9]+.gz - ancient statistics
SEE ALSO battery-graph(1), battery-stats-collector(8).
AUTHOR
Karl E. Jorgensen <karl@jorgensen.com>
September 23, 2002 BATTERY-STATS(5)