Skip to main content

Linux commands

sudo!! : Forgot to run a command with sudo? You need not re-write the whole command, just type "sudo!!" and the last command will run with sudo.
2. Python -m SimpleHTTPServer : Creates a simple web page for the current working directory over port 8000.
3. mtr : A command which is a combination of 'ping' and 'traceroute' command.
4. Ctrl+x+e : This key combination fires up, an editor in the terminal, instantaneously.
5. nl : Outputs the content of text file with lines Numbered.
6. shuf : Randomly selects line/file/folder from a file/folder.
7. ss : Outputs Socket Statistics.
8. Last: Want to know history of last logged in users? This command comes to rescue here.
9. curl ifconfig.me : Shows machine's external IP Address.
10. tree : Prints files and folders in tree like fashion, recursively.
11. Pstree : Prints running processes with child processes, recursively.
13. stat : Shows the status information of a file as well as of a file system.
15. Pv : outputs simulating text, similar to hollywood movies.
16. Mount | column -t : Lists mounted file system, in nice formatting with specification.
17. Ctrl + l: clear shell prompt, instantaneously.
18. curl -u gmail_id --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "\t" if //; print "$2\n" if /(.*)/;'. This simple scripts, opens up, unread mail of an user, in the terminal itself.
19. screen : Detach and Reattach, long running process from a session.
20. file : Outputs information, regarding types of file.
21. id : Print User and Group Id.
22. ^foo^bar : Run last command with modification, without the need of rewriting the whole command again.
24. at : Run a particular command, time based.
25. du -h --max-depth=1 Command : Outputs the size of all the files and folders within current folder, in human readable format.
26. expr : Solve simple mathematical calculations from the terminal.
27. look: Check for an English word, from the dictionary, in case of confusion, right from the shell.
28. yes : continues to print a sting, till interrupt instruction is given.
29. factor: Gives all the possible factors of a decimal number.
30. ping -i 60 -a IP_address : Pings the provided IP_address, and gives audible sound when host comes alive.
31. tac : Prints content of a file, in reverse order.
32. strace : A debugging tool.
33. disown -a && exit Command : Run a command in background, even after terminal session is closed.
34. getconf LONG_BIT Command : Output Machine Architecture, very clearly.
35. while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-29));date;tput rc;done & : The script outputs date and time on the top right corner of shell/ terminal.
36. convert : converts the output of a command in picture, automatically.
37. watch -t -n1 "date +%T|figlet" : Show animated digital clock at the prompt.
38. host and dig : DNS lookup utility.
39. dstat : Generates statistics regarding system resource.
40. bind -p : Shows all the shortcuts available in Bash.
41. Touch /forcefsck : Force file-system check on next boot.
42. lsb_release : Prints distribution specification information.
43. nc -ZV localhost port_number : Check if a specific port is open or not.
44. curl ipinfo.io : Outputs Geographical Information, regarding an ip_address.
45. find .-user xyz : Lists all file owned by user 'xyz'
46. apt-get build-dep package_name: Build all the dependency, automatically while installing any specific package.
47. lsof -iTCP:80 -sTCP:LISTEN. The script, outputs all the service/process using port 80.
48. find -size +100M : This command combination, Lists all the files/folders the size of which is 100M or more.
49. pdftk : A nice way to concatenate a lot of pdf files, into one.
50. ps -LF -u user_name : Outputs Processes and Threads of a user.
51. Startx — :1 (This command creates another new X session).
top 6 files that eat up your space:
du -hsx * | sort -rh | head -6
  • Alt+Backspace: Deletes the previous word.
  • Alt+F: Skips ahead to the next space.
  • Alt+B: Skips back to the previous space.
  • Ctrl+U: Cuts all text up to the cursor.
  • Ctrl+K: Cuts all text after the cursor until end of line.
  • Ctrl+A: Moves the cursor to the start of line.
  • Ctrl+E: Moves the cursor to the end of line.

Comments

Popular posts from this blog

Terraform

Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions. Configuration files describe to Terraform the components needed to run a single application or your entire datacenter. Terraform generates an execution plan describing what it will do to reach the desired state, and then executes it to build the described infrastructure. As the configuration changes, Terraform is able to determine what changed and create incremental execution plans which can be applied. The infrastructure Terraform can manage includes low-level components such as compute instances, storage, and networking, as well as high-level components such as DNS entries, SaaS features, etc. The key features of Terraform are: Infrastructure as Code : Infrastructure is described using a high-level configuration syntax. This allows a blueprint of your datacenter to be versioned and...

Salt stack issues

The function “state.apply” is running as PID Restart salt-minion with command:  service salt-minion restart No matching sls found for ‘init’ in env ‘base’ Add top.sls file in the directory where your main sls file is present. Create the file as follows: 1 2 3 base: 'web*' : - apache If the sls is present in a subdirectory elasticsearch/init.sls then write the top.sls as: 1 2 3 base: '*' : - elasticsearch.init How to execute saltstack-formulas create file  /srv/pillar/top.sls  with content: base : ' * ' : - salt create file  /srv/pillar/salt.sls  with content: salt : master : worker_threads : 2 fileserver_backend : - roots - git gitfs_remotes : - git://github.com/saltstack-formulas/epel-formula.git - git://github.com/saltstack-formulas/git-formula.git - git://github.com/saltstack-formulas/nano-formula.git - git://github.com/saltstack-f...

Helm: Installation and Configuration

PREREQUISITES You must have Kubernetes installed. We recommend version 1.4.1 or later. You should also have a local configured copy of  kubectl . Helm will figure out where to install Tiller by reading your Kubernetes configuration file (usually  $HOME/.kube/config ). This is the same file that  kubectl  uses. To find out which cluster Tiller would install to, you can run  kubectl config current-context or  kubectl cluster-info . $ kubectl config current-context my-cluster INSTALL HELM Download a binary release of the Helm client. You can use tools like  homebrew , or look at  the official releases page . For more details, or for other options, see  the installation guide . INITIALIZE HELM AND INSTALL TILLER Once you have Helm ready, you can initialize the local CLI and also install Tiller into your Kubernetes cluster in one step: $ helm init This will install Tiller into the Kubernetes cluster you saw with  kubectl config current-context . TIP:  Want to install into a different cl...