<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="/show.xsl" ?>
<qalist name="QA-default" updated="2026-05-20 02:06:55" >
<entry id="1">
<question><![CDATA[^.*(add).*(user).*$]]></question>
<answer><![CDATA[Add a user and create its home directory automatically:
- sudo adduser <username>
Add a user without a home directory:
- sudo useradd <username>
- sudo passwd <username>]]></answer>
</entry>

<entry id="2">
<question><![CDATA[^.*((un)*archive|(de)*compress|expand|extract).*$]]></question>
<answer><![CDATA[Archive and compress files:
- tar cfvz archive.tar.gz file1 file2 ...
Unarchive and decompress files:
- tar xfvz archive.tar.gz]]></answer>
</entry>

<entry id="3">
<question><![CDATA[.*(list).*(?=.*\barchive\b)(?=.*\bcontent\b).*]]></question>
<answer><![CDATA[List content of an archive:
- tar tfv archive.tar]]></answer>
</entry>

<entry id="4">
<question><![CDATA[.*(ssh).*(tunnel).*]]></question>
<answer><![CDATA[SSH tunnel (SOCKS proxy) for browsing:
- ssh -fCqN -p 22 -D 5000 user@server
SSH tunnel for IRC:
- ssh -fCqN -L 6667:irc.server:6666 user@ssh.server]]></answer>
</entry>

<entry id="5">
<question><![CDATA[.*(scan).*(net(work)?).*]]></question>
<answer><![CDATA[Scan network for running machines:
- nmap -sP 192.168.1.0/24]]></answer>
</entry>

<entry id="6">
<question><![CDATA[.*(convert).*(all).*(image(s)?|picture(s)?).*]]></question>
<answer><![CDATA[Convert all images in a directory:
- for file in *.jpg; do convert $file `basename $file .jpg`.eps; done]]></answer>
</entry>

<entry id="7">
<question><![CDATA[.*(add).*(line).*(numbers).*]]></question>
<answer><![CDATA[Add line numbers to text file:
- nl -s " " -b a /path/to/text.file >> file.txt]]></answer>
</entry>

<entry id="8">
<question><![CDATA[.*(replace|substitute).*(comma|period).*]]></question>
<answer><![CDATA[Substitute period for comma in all files:
- for file in *.txt; do sed -i 's/,/./g' "$file"; done]]></answer>
</entry>

<entry id="9">
<question><![CDATA[.*(concatenate|combine).*(pdf).*]]></question>
<answer><![CDATA[Concatenate PDF files:
- pdftk file1.pdf file2.pdf file3.pdf cat output out.pdf]]></answer>
</entry>

<entry id="10">
<question><![CDATA[.*(split|cut|extract).*(pdf).*]]></question>
<answer><![CDATA[Cut pages from PDF files:
- pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf]]></answer>
</entry>

<entry id="11">
<question><![CDATA[.*(rotate).*(pdf).*]]></question>
<answer><![CDATA[Rotate all pages by 180 degrees:
- pdftk in.pdf cat 1-endS output out.pdf
Rotate a single page by 90 degrees:
- pdftk in.pdf cat 1E 2-end output out.pdf]]></answer>
</entry>

<entry id="12">
<question><![CDATA[.*(size).*(directory|folder).*]]></question>
<answer><![CDATA[Display size of directory in human-readable form:
- du -hs /foobar]]></answer>
</entry>

<entry id="13">
<question><![CDATA[.*(?=.*combine)(?=.*file)(?=.*column).*]]></question>
<answer><![CDATA[Combine two files column-wise:
- pr -m -t file1.txt file2.txt > out.txt]]></answer>
</entry>

<entry id="14">
<question><![CDATA[.*(remove|delete).*(blank|space).*(file).*]]></question>
<answer><![CDATA[Remove blanks from file:
- sed -e 's/ //g' filename > filename_new]]></answer>
</entry>

<entry id="15">
<question><![CDATA[.*(delete|remove).*(regex).*(file).*]]></question>
<answer><![CDATA[Delete REGEX matches from file:
- cat todo.txt | sed 's/^.*pdf\///g' > done.txt]]></answer>
</entry>

<entry id="16">
<question><![CDATA[.*(delete|remove).*(?=.*regex)(?=.*(directory|folder)).*]]></question>
<answer><![CDATA[Delete directories that match REGEX:
- find . -maxdepth 1 -type d -regex "\./.*201[23]" -exec rm -rf {} \;]]></answer>
</entry>

<entry id="17">
<question><![CDATA[.*((password.*less)|((without|no).*password)).*]]></question>
<answer><![CDATA[Add to sudoers file with visudo to allow passwordless execution:
- username ALL=(root) NOPASSWD: /usr/bin/apt-get]]></answer>
</entry>

<entry id="18">
<question><![CDATA[.*(clear|delete|forget|flush).*(shell|bash|command.*line).*(history).*]]></question>
<answer><![CDATA[Clear shell history:
- history -c && history -w]]></answer>
</entry>

<entry id="19">
<question><![CDATA[.*(find|list).*(large).*(file).*]]></question>
<answer><![CDATA[Find large files:
- find / -size +10M -ls]]></answer>
</entry>

<entry id="20">
<question><![CDATA[.*(add|change|update|modify).*(?=.*group)(?=.*user).*]]></question>
<answer><![CDATA[Add existing user to existing group:
- usermod -a -G groupname username
Change primary group of user:
- usermod -g groupname username]]></answer>
</entry>

<entry id="21">
<question><![CDATA[^.*(use).*(how).*$]]></question>
<answer><![CDATA[Type a question that starts with "how" in the command line. Just as you did right now ... ;-)
Example:
- how to add users in ubuntu
- how to compress files
- how to change the group of a user]]></answer>
</entry>

<entry id="22">
<question><![CDATA[^.*(archive|rsync|backup).*(file|director(y|ies)|data).*$]]></question>
<answer><![CDATA[Use rsync with the following options:
- rsync -avzP /directory/to/backup /local/backup/directory/]]></answer>
</entry>

<entry id="23">
<question><![CDATA[^.*(search|find).*(file|folder|directory).*$]]></question>
<answer><![CDATA[Find a REGEX pattern in TEXT files:
- grep -rnw /search/directory/ -e "regex pattern"
Find a REGEX pattern in PDF files:
- pdfgrep -rni "regex pattern" /search/directory/]]></answer>
</entry>

<entry id="24">
<question><![CDATA[^.*(scan).*(network|subnet).*$]]></question>
<answer><![CDATA[Scan a subnet over port range (-PN takes longer but detects firewalled machines):
- nmap -PN -p 1-800 --open 192.168.1.0/24
- nmap -p 1-800 --open 192.168.1.0/24
]]></answer>
</entry>

<entry id="25">
<question><![CDATA[^.*(refresh|update|load).*(key|pacman).*$]]></question>
<answer><![CDATA[In case of faulty signatures with Pacman, updating the keys might help:
- sudo pacman-key --refresh-keys]]></answer>
</entry>

<entry id="26">
<question><![CDATA[.*(mount|read|use).*(iso|ISO).*]]></question>
<answer><![CDATA[To mount an ISO file:
- mount -o loop /pfad_zum_image/image.iso/mnt/disk
]]></answer>
</entry>

<entry id="27">
<question><![CDATA[.*(unban|unblock|fail2ban).*]]></question>
<answer><![CDATA[List fail2ban rules in iptables:
- iptables -L -n
Unban IPs from fail2ban jail:
- fail2ban-client set YOURJAILNAMEHERE unbanip IPADDRESSHERE
]]></answer>
</entry>

<entry id="28">
<question><![CDATA[.*(package).*]]></question>
<answer><![CDATA[Create package list (Arch):
- pacman -Qqen > pkglist.txt
- pacman -Qqem > pkglist_aur.txt
Install from package list (Arch):
- sudo pacman -S --needed $(comm -12 <(pacman -Slq|sort) <(sort pkglist.txt) )
- pacaur -S --noedit --noconfirm --needed pkglist_aur.txt
Remove packages that are not in lits (Arch):
- sudo pacman -Rsu $(comm -23 <(pacman -Qq|sort) <(sort pkglist))]]></answer>
</entry>

</qalist>
