Problem
You want to display the full path of files using ls, perhaps to use it as an input to a different command (ie rm).
Solution
You can use the following:
ls -d -1 /path/with/files/*.*
Taken from: here.
Problem
You want to display the full path of files using ls, perhaps to use it as an input to a different command (ie rm).
Solution
You can use the following:
ls -d -1 /path/with/files/*.*
Taken from: here.
If you would like to know how your linux system was booted type the following to give you the information that you need:
$ cat /proc/cmdline BOOT_IMAGE=/boot/vmlinuz-3.13.0-62-generic.efi.signed root=UUID=7ef51656-acfc-4d01-aa94-90f7042b2e28 ro quiet splash vt.handoff=7
Problem
You have multiple pdf pages and you want to combine them into one file.
Solution
Use pdftk to combine them into one file like:
pdftk page1.pdf page2.pdf page3.pdf cat output combined_file.pdf
Problem
You have started a couple of guest linux sessions on your pc, that you do not need anymore (ie giving access to your children while on holiday 🙂 ), and you want to close them from your own session.
Solution
Find out about the guest users by using who:
who ... guest-kk9tnS :2 2015-08-09 17:39 (:2) guest-kk9tnS pts/21 2015-08-09 17:40 (:2)
and then kill the sessions using pkill:
sudo pkill -9 -u guest-kk9tnS
Problem
You have a pdf file with sensitive information and you want to protect it with a password.
Solution
Install the pdftk if you haven’t already in your system:
sudo apt-get install pdftk
And then run the following to prompt for a password before opening the file:
pdftk original.pdf output pswd_protected.pdf user_pw PROMPT
Problem
You want to run a service/script on a server that you have logged in with ssh, but you want to leave it running even after you have terminated the ssh session.
Solution
Use the nohup command so do the following in your ssh session:
nohup /service/i_want_to_run &
Problem
You want to search in a directory or some files for a specific string and you also want to know the number in the file that the text is found.
Solution
Use grep with the -n for the line number and the -r for directory search as in the following:
grep -n -r 'search_item' /path/to/folder/
Problem
You have forgotten your web-gui credentials to login into your dd-wrt router but you have still telnet access to it.
Solution
Login with telnet to your router and then run the following two commands to reset the web interface:
nvram set http_passwd= nvram commit
and then go to your Web interface to set a new one.
* Based on this post
Problem
You would like to set up your vim editor to use 2 spaces for the tab character.
Solution
Add the following to your ~/.vimrc file:
set ts=2
Problem
You have setup your Rails app to send out emails using postfix, but you also want to redirect the incoming emais to a different account.
Solution
Edit the postfix configuration file vi /etc/postfix/main.cf and add the following two lines at the bottom:
virtual_alias_domains = outgoing_domain.com virtual_alias_maps = hash:/etc/postfix/virtual
And then add the redirections to the virtual file with vi /etc/postfix/virtual:
outgoing_email@outgoing_domain.com other_account@other_domain.com @outgoing_domain.com other_account@other_domain.com
Then run the following two commands to restart postfix:
postmap /etc/postfix/virtual postfix reload
* Based on the post here