-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUbuntu_tricks1
167 lines (116 loc) · 5.1 KB
/
Ubuntu_tricks1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
To install from a PPA :
1) sudo add-apt-repository ppa:name/ppa
2) sudo apt update
3) sudo apt install <package_name>
------------------------------------------------------------
Wireshark
To make Wireshark run without root privileges
=> sudo dpkg-reconfigure wireshark-common
-------------------------------------------------------------
Add folder to PATH
1) sudo nano /etc/environment
2) Add the complete path to the folder , to the current value of PATH with a
semicolon before it .
3) Reboot . W/o reboot it won't have an effect .
This is permanant and system wide ie: for all users .
To remove the folder from PATH
1) sudo nano /etc/environment
2) Remove the folder from the value of PATH
3) Reboot .
Make script execute on STARTUP
[For Ubuntu]
At the end of contents of .profile (test if it works for .bashrc) add
bash /path_to_script
Schedule tasks using Crontab
1) crontab -l
2) crontab -e //opens crontab file
3) m h dom mon dow command => minute hour dayOfMonth DayOfWeek Command
4) Enter task in the format as specified in step 3
5) Save and exit & Viola !
---------------------------------------------------------------------------
Add a user
1) sudo adduser <userName>
2) usermod -G sudo <username> <= adds the new user to group sudoers
3) Then it asks for password , full name , contact no. and stuff.
Login as another user from terminal : su - <username>
Then it asks for password . Enter correct password and Viola
-----------------------------------------------------------------------------
GPU commands
1) inxi -G // displays all info about all GPUs
2) lspci // gives info about all physical ports including GPU
-----------------------------------------------------------------------------
MYSQL
Installation
1) sudo apt install mysql-server // installs the default install package
2) sudo mysql_secure_installation
For best reference : https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04
Uninstallation
1) sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
2) sudo rm -rf /etc/mysql /var/lib/mysql
3) sudo apt-get autoremove
4) sudo apt-get autoclean
---------------------------------------------------------------------------------------------
Display time dynamically on terminal :
watch -n1 "date '+%D%n%T'|figlet -k"
---------------------------------------------------------------------------------------------
MOUNT USB
Command to see already mounted devices : mount
It displays all partitions of all mounted devices .
For my 4 GB USB , it is /dev/sdb1
To unmount it : umount /dev/sdb1
Be carefull , which partition you specify .
1)create folder /media/el1t3/usb-drive
2)mount /dev/sdb1 /media/el1t3/usb-drive
3)cd /media/el1t3/usb-drive and you can read all the files .
4) However , to be able to edit them you must be in root . So do : sudo su
Eject :
sudo eject /dev/sdb1
[Check man page of eject]
------------------------------------------------------------------------------------
CHANGE ICON OF SOFTWARE
Only tested it on eclipse installation
Downloaded Eclipse from https://www
After installing
----------------------------------------------------------------------------------
MISCELLENOUS :
<return> key is Ctrl
<Super> key is the key with Windows icon on it.
To the left of Alt and to the right of Fn.
Whatever is saved in /tmp folder gets deleted on
next boot as the name implies "temporary"
Another way to execute a file without making it an
executable : . <filename>
example : to reload bash settings => . .bashrc
To execute a file in current directory
Method 1 : . <file_name>
Method 2 : <Program_nam>e ./<file_name>
eg : If it is a bash script then => bash ./<file_name>
If it is a python script then => python ./<file_name>
Method 3 : ./<file_name> // Required <file_name> to be an executable
Method 4 : . /FULL/PATH/TO/CURRENT/DIRECTORY/<file_name>
From what I understand . means current directory .
To execute a file in parent directory
Method 1 : <Program_name> ../<file_name>
eg: If it is a bash script then => bash ../<file_name>
If it is a python script then => python ../<file_name>
Method 2 : ../<file_name> //Requires <file_name> to be an executable
Another way to shutdown now :
systemctl poweroff -i // more powerful . Logs out other users
that are logged in and shuts down
reset command clear the screen and literally resets the terminal .
Does not delete history and does not launch terminal again cuz it doesn't
read .bashrc file
-------------------------------------------------------------------------------
LAUNCH FROM TERMINAL
1) Mozilla Firefox => firefox &
2) Transmission => transmission-gtk &
3) VLC with a paticular file =>
vlc <path to video file> --sub-file <path to srt file> --fullscreen &
4) .docx using LibreOffice Writer => lowriter <path/to/file>
The & symbol puts the process in background .
If & is not used , the terminal can't be used after.
----------------------------------------------------------------------
29/7/18
1) Install Etcher
2) aliases
3) Encrypt/decrypt files with gpg