Last active
October 31, 2015 15:01
-
-
Save junaidk/4a6e0284798c7cbea994 to your computer and use it in GitHub Desktop.
count character in each line of a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if number of occurrences of " , " is > 5 print the number | |
tr -d -c ',\n' < Users.csv | awk '{ if ( length >= 5) {print length;} }' | |
# if number of occurrences of " , " is > 5 print line number | |
tr -d -c ',\n' < Users.csv | awk '{ if ( length >= 5) {print NR;} }' | |
# read nth line from file | |
awk ' NR == 5' Users.csv | |
# cron job rsync with log | |
# install ts for timeStamping | |
sudo apt-get install moreutils | |
*/30 * * * * rsync -azv <source> --password-file=<password file> <user>@<host>::<user> | ts >> <logFile> | |
# select range of lines from text file | |
sed -n 16224,16482p filename > newfile | |
# wget with cookies (authenticated) | |
# Log in to the server. This can be done only once. | |
wget --save-cookies cookies.txt \ | |
--post-data 'user=foo&password=bar' \ | |
http://server.com/auth.php | |
# Now grab the page or pages we care about. | |
wget --load-cookies cookies.txt \ | |
-p http://server.com/interesting/article.php | |
http://stackoverflow.com/questions/1324421/how-to-get-past-the-login-page-with-wget | |
# Add ssh keys to server | |
ssh-copy-id <user>@<server> | |
https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2 | |
# curl file upload | |
curl -v -include --form "path=ab/cd/" --form "overwrite=true" --form upload=@wd_rsync.log http://192.168.0.1:8080/upload | |
# Find out current working directory of a running process | |
pwdx <pid> | |
http://unix.stackexchange.com/questions/94357/find-out-current-working-directory-of-a-running-process | |
# find simlink | |
readlink -f `which command` | |
# How do I move files out of nested subdirectories into another folder in ubuntu? | |
http://superuser.com/questions/658075/how-do-i-move-files-out-of-nested-subdirectories-into-another-folder-in-ubuntu | |
# transmission | |
https://help.ubuntu.com/community/TransmissionHowTo | |
http://askubuntu.com/questions/221081/permission-denied-when-downloading-with-transmission-deamon | |
``` | |
sudo usermod -a -G debian-transmission <user> | |
sudo chgrp debian-transmission /path/to/folder/ | |
sudo chmod 775 /path/to/folder/ | |
``` | |
# samba conf | |
set folder permission to 775 | |
/etc/samba/samba.conf | |
``` | |
[Downloads] | |
path = /home/cloud1/transmission/Downloads | |
available = yes | |
browsable = yes | |
writable = no | |
public = yes | |
guest only = yes | |
guest ok = yes | |
``` | |
sudo service smbd restart | |
# mount samba share | |
``` | |
su (make sure you do this as root) | |
mkdir /mnt/linky_share | |
mount -t cifs -o user=luke //192.168.1.104/share /mnt/linky_share | |
``` | |
https://wiki.samba.org/index.php/Mounting_samba_shares_from_a_unix_client | |
# get installed package list | |
https://askubuntu.com/questions/17823/how-to-list-all-installed-packages | |
# search with in files in folder | |
grep -Ril "text-to-find-here" / | |
https://stackoverflow.com/questions/16956810/finding-all-files-containing-a-text-string-on-linux | |
# install java oracle ubuntu | |
https://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-jdk-6-7-8-or-jre | |
# locale problem | |
add this `LC_ALL="en_US.UTF-8"` to bottom of `/etc/environment` | |
# ubuntu print canon driver | |
https://wiki.debian.org/PrinterDriver/Canon/UFR-II |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment