Skip to content

tech.

How to Create programs, Fix, Find and Configure them

  • Tips&Tricks
  • How to fix
  • For Beginners
  • Français
    • English
    • Español
    • Deutsch
    • 简体中文

Tag: Bash

Tips&Tricks

How to run a program as daemon without any output

Gosh On January 30, 2019January 30, 2019
How to run a program as daemon without any output

Each program has a set of file descriptors. It’s like an open stream from / to file. On start program has 3 descriptors: standard input (stdin), standard output (stdout) and standard error (stderr). They has numbers: from 0 to 2. Standard input is used for reading input data from the user (from the terminal). StandardContinue Reading


Tips&Tricks

How to get top 10 largest files

Gosh On January 29, 2019January 29, 2019
How to get top 10 largest files

As we already saw, we can easily get to 10 largest directories (see “How to get top 10 largest directories in the current directory“). But there we used du utility – it shows directory size (or “estimate file space usage”). What utility shows file size? Oh… It’s just the ls! Looks easy? But we needContinue Reading


For Beginners

Three useful keys of tail util

Gosh On January 29, 2019January 29, 2019
Three useful keys of tail util

tail – output the last part of files. Print the last 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. With no FILE, or when FILE is -, read standard input. Tail’s keys Show last ‘num’ lines in file: tail -n {{num}}Continue Reading


Tips&Tricks

How to get top 10 largest directories in the current directory

Gosh On January 29, 2019January 29, 2019
How to get top 10 largest directories in the current directory

Sometimes it’s not obvious, which directory is too big. To find the biggest directories in you computer, you may use graphic user interface and some of supported file managers. But what will you do when you don’t have a GUI? And it’s not mythical situation. On the desktop you almost always know the biggest directoryContinue Reading


For Beginners

Useful keyboard shortcuts in Bash for beginners

Gosh On January 29, 2019January 29, 2019
Useful keyboard shortcuts in Bash for beginners

Hotkeys in Bash helps you use Bash more efficiency. Most of them have slower analogs. But some of them help you easier do common things. Ctrl + a – Return to the start of the command you’re typing Ctrl + e – Go to the end of the command you’re typing Ctrl + u – Cut everything beforeContinue Reading


For Beginners

Bash history util for beginners

Gosh On January 29, 2019January 29, 2019
Bash history util for beginners

history is a program for tracking terminal input. Many programs read input from the user a line at a time. The GNU History library is able to keep track of those lines. It associates arbitrary data with each line, and utilize information from previous lines in composing new ones. Tips and examples Display the commandsContinue Reading


Tips&Tricks

How to fix the last command in Bash

Gosh On January 29, 2019January 29, 2019
How to fix the last command in Bash

Sometimes we all makes mistakes. And it’s good if this is just typo in command name and we don’t erase important data. So, if it was just a typo Bash gives to us easy way to fix it! Takes the last command, replaces string1 with string2 and executes it. ^string1^string2 For example: $ ehco fooContinue Reading


For Beginners

Useful shortcuts for Beginners in Bash – BANG!

Gosh On January 29, 2019January 29, 2019
Useful shortcuts for Beginners in Bash – BANG!

Bash is not the only programming language. The most important it’s a shell. When you run a terminal, you get a bourne-again Shell. And it has special shortcuts and predefined special variables. For example, $? contains the last exit code, $PS1 is a template of Bash prompt. But now we’ll talk about “bang” shortcuts. Examples:Continue Reading


Tips&Tricks

How to count words with grep

Gosh On January 28, 2019January 28, 2019
How to count words with grep

Grep command in Unix/Linux is the short form of ‘global search for the regular expression’. The grep command is a filter that is used to search for lines matching a specified pattern and print the matching lines to standard output. Piping to wc util is slow: ~ $ time grep and tmp/a/longfile.txt | wc -l2811real 0m0.097s userContinue Reading


For Beginners

Less utility for beginners

Gosh On January 27, 2019January 27, 2019
Less utility for beginners

less is a terminal pager program for Linux, MacOS (Unixes) and even Windows. It’s used to viewing (but not changing) the contents of a text file one screen at a time. You can try in you terminal: less /etc/passwd – if you use Unix-like system. Note: press q to quit. Most Linux users know about navigationContinue Reading


Posts navigation

Older Posts
arrow-right

Recent Posts

  • How to use/add a self-signed certificate to Mac OS
  • How to delete all Docker images and containers
  • How to change permissions for file / directory recursively in Linux
  • How to install non-free video / audio codecs in Ubuntu
  • Python 3 performance profiling – easiest way

Archives

  • February 2020
  • June 2019
  • January 2019

Categories

  • For Beginners
  • How to fix
  • Tips&Tricks