linux

unusual-linux-commands

Unusual linux commands can be very handy in several cases. Here are some of them. Repeat the last typed command: !!   Display file-content like cat, but from upside down, can be achieved with tac (reverse cat) tac myfile.txt   Like to lookup in a dictionary file? Use look. Everything whats starts with the passed word will be shown. look car   Display time / date in bash screen on right upper corner. Continously! while sleep 1;do tput sc;tput cup 0 $(($(tput…

0
Read More

Linux Tutorial Part2

Read Linux Tutorial Part1, before you start here. Commands you have head about in Part1 are: whoami, hostname, uname, uptime, clear, pwd, cd, echo, ~ and others. In the second part of the Linux Tutorial, we will learn about dealing with files and folders (directory). First move to your home directory with (change directory): cd Now let us create a directory, named „garage“, with the „make directory“ command: mkdir garage You have created the garage directory, but you are still inside…

0
Read More

Linux Tutorial Part1

These tutorials explain the Linux operating system (os) step by step. Starting with simple examples and getting more advanced each lesson. The line where we type in the commands is called the prompt, the blinking something right to it is the cursor. Lets show who is logged in: whoami And the hostname of the computer can be shown with: hostname As you can see, username and hostname are contained in the prompt. If you want to know the name of…

0
Read More

Monitoring network traffic

tcpdump You want to track all incomming http-Headers on your Webserver? sudo tcpdump -A -s 10240 ‚tcp port 80′ | egrep –line-buffered „^……..(GET |HTTP\/|POST |HEAD )|^[A-Za-z0-9-]+: “ | sed -r ’s/^……..(GET |HTTP\/|POST |HEAD )/\n\1/g‘ Show the HTTP Requests only: sudo tcpdump -A -s 10240 ‚tcp port 80′ | egrep „^……..(GET |HTTP\/|POST |HEAD )|^[:alnum:]+: “ | sed -r ’s/^……..(GET |HTTP\/|POST |HEAD )/\n\1/g‘ capture for a specific URL string (only inside the url’s path) sudo tcpdump -s0 -A -vv | grep „myPathString“…

0
Read More

PDF Frontpage to jpg

First find all the files you want to convert and store their filenames in a file find my-pdf-folder/ -type f -name „*.pdf“ > pdffiles.txt Iterate through that files and make a jpeg from them while read -r LINE; do pdftoppm -f 1 -singlefile -jpeg „$LINE“ „$LINE“; done < pdffiles.txt Finally move all jpgs to a separate location if necessary find my-pdf-folder/ -type f -name „*.jpg“ -exec mv {} jpgs/ \;  

0
Read More

perform action on multiple files found with find command

In reality you have quite often perform a certain command on several files. First i detect all files I’m looking for and store them in a filelist. find . -name „myFilename“ > filelist.txt Second i run through this file, line by line and perform my command on all filename I’ve received one step before. while read -r LINE; do echo „$LINE“; done < filelist.txt You need to replace in several files. You can do it with sed. Be aware about…

0
Read More

how to detect space usage in linux

Getting the size of all files and folders inside the current directory can be done by typing:  ls | xargs du -s -BM Get filesize in descending order from all files in a recursive folder structure find . -type f -exec du -a -h –max-depth=100 {} + | sort -hr Another quite handy tool is ncdu. It provides you the disc usage in a graphical way on the shell. Install it like this: sudo apt-get install ncdu List folders bigger…

0
Read More

handle multiple shell sessions with tmux

What is tmux? A handy tool for dealing with different bash sessions is tmux. It’s comparable with gnu screen but by far more advanced. You can get it with: sudo apt-get install tmux Launch it by typing: tmux Shortcuts an Commands Dealing with sessions brings great power. You can set up your multi-windows panes on a remote machine, in a seperate session. Now you can detach from this session and log out. When you later ssh back into this machine…

0
Read More

Monitoring processes with htop on the shell

Want to have a more advanced and easy (intuitive) tool than top, for monitoring, sorting, filtering, killing processes? than htop is the tool of your choice. Simply install it by using: sudo apt-get install htop and start it with: htop Have fun watching your processes.

0
Read More

vim tipps

show all visible characters like spaces, tabs, line breaks / hide all visible characters set list set nolist Enable / Disable syntax highlighting syntax on syntax off Enabling current row and column highlighting set cursorline set cursorcolumn Enabling relative line numbering (cursor is always at zero) set relativenumber Indentation in vi you want to mark something in visual mode, and indent the selected part several times to the left or the right? First, you add these lines to your .vimrc vnoremap < <gv…

0
Read More