Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *********************************** Ubuntu terminal tips ***********************************
- *********************************** Author: Pallavi Patni **********************************
- Linux Tips
- ----------
- 1. To kill xsp server-
- kill `ps aux|grep xsp4.exe|grep -v grep|awk '{print $2}'`
- 2. To kill a process-
- display all currently running processes: ps -ef
- kill particular process: kill [processID] ; processID can be viewed from the above command
- 3. To remove non-empty directory-
- rm -rf foldername
- note: rf is for recursive removal of files and the directory
- 4. To get the count of Terminal-windows open-
- who|grep "pts"|wc -l
- 5. View/Change system's datetime-
- view- date
- change- date MMddHHmmyyyy.ss
- 6. make softlinks (aka symbolic links, symlinks; aka virtual folders in MS windows)
- ln -s /[folder-path] /[softlink-foldername]
- 7. Read physcial path (actual path) of a softlink-
- readlink -f [softlink-path]
- 8. To run a program in background, even if the Terminal gets closed (deliberately or whatever)-
- setsid[ProgramName]
- e.g., setsid gnome-calculator
- (alternative to setsid is nohup)
- 9. shutoff/restart system-
- sudo poweroff
- sudo reboot
- 10. go to Task-manager-
- gnome-system-monitor
- 11. Use sudo's pwd in single command (without shell to prompt for pwd)-
- $sudo -S <<< 'your_pwd' [command]
- e.g., $sudo -S <<< 'pppp' chmod 777 /home/administrator/myfolder/myfile.txt
- 12. Execute a shell script-
- #sh myscript.sh[arg1,arg2,..]
- Errors with solutions
- 1. sudoers are world-writable; i.e., full permissions are given to /etc/ and you cannot login to terminal as sudo; hence cannot change its permissions;
- $pkexec chmod 0440 /etc/sudoers
- 2.
- MySQL Tips
- ----------
- 1. Check hosts-
- select host from mysql.user where user ='root';
- 2. Make one server's (or machine's) MySQL to get instantiated from other MySQLs (on other servers)-
- Open file /etc/mysql/my.cnf & change '127.0.0.1' under element 'bind-address' to the IP of the server & restart MySQL service
- 3. change password for root in MySQL-
- use mysql;
- update user SET password = password('new-password')
- WHERE host= 'localhost' AND user = 'root' ;
- and for setting password for remote access as well-
- update user SET password = password('new-password')
- WHERE host= '%' AND user = 'root' ;
- 4. Execute a MySQL query through command-line-
- #mysql -u[username] -p[password] [dbname]<query.sql> output.tab;
- 5. If you don't want to type the username and password in the command-line statements, save it in the my.cnf file, as follows:
- in the [client] element in my.cnf, user = [username]
- password = [password]
- 6. Getting the result of a MySQL command to a file
- mysql -host[ip-address] -p[password] <query.sql> > filename.log 2>&1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement