history This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ===== Change file/folder permission (chown) ===== ==== Using "number-mode" ==== ''print('hello world')'' <html> <ul> <li style="color: green">a = all</li> <li style="color: greenyellow">g = group</li> <li style="color: aqua">o = other</li> <li style="color: red">u = user (owner)</li> </ul> <pre>chmod <span style="color: red">{owner}</span> - <span style="color: greenyellow">{group}</span> - <span style="color: aqua">{other}</span> filename </pre> </html> ==== Search for files and chown them ==== use "find . -type d ..." for directorys): find . -type f -not \( -name "file1.txt" -o -name "file2.lol" -o -name "file3.\*" \) -print0 | xargs -0 chown [username] ---- ===== Find files containing text ===== <code bash>grep -rwl "search-string" /path/to/serch/dir</code> ===== Working with external storage ===== === Mount USB: === <html> <pre>sudo fdisk -l sudo mount -t vfat /dev/... </pre> </html> ===== Ejabberd ===== === Delete chat === <html><pre class="code"><span style="user-select: none;">$ </span>ejabberdctl remove_mam_for_user_with_peer maxmustermann your.address admin@somepi.ddns.net</pre></html> ===== Show free diskspace ===== <html><pre class="code"><span style="user-select: none;">$ </span>sudo df -h</pre></html> ===== Working with .tar archives ===== === Compress === <html><pre class="code"><span style="user-select: none;">$ </span>tar -czvf name-of-archive.tar.gz /path/to/directory-or-file</pre></html> === Extract === <html><pre class="code"><span style="user-select: none;">$ </span>tar -xzvf archive.tar.gz -C /path/to/extract</pre></html> * x extract * v verbos * f files * c compress * z use gzip compression * -C output path ===== MYSQL ===== === Reset auto_incerement to 0 === <html><pre class="code"><span style="user-select: none;">MYSQL > </span>ALTER TABLE [YOUR_TABLE] auto_increment = 0;</pre></html> === IMPORT DUMP FILE === <html><pre class="code"><span style="user-select: none;">$ </span>sudo mysql -u root -p [DATABASE] < [DUMP_FILE].sql</pre></html> === Show the path to database files === <html><pre class="code"><span style="user-select: none;">$ </span>sudo mysql -u root -p -e "SELECT @@datadir;"</pre></html> === SHOW ALL USERS === <html><pre class="code"><span style="user-select: none;">MYSQL > </span>SELECT User, Host, Password FROM mysql.user;</pre></html>