🖥️ruby
➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the ruby command with important options and switches using examples.
2 minute read
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# ██████╗ ██╗ ██╗██████╗ ██╗ ██╗
# ██╔══██╗██║ ██║██╔══██╗╚██╗ ██╔╝
# ██████╔╝██║ ██║██████╔╝ ╚████╔╝
# ██╔══██╗██║ ██║██╔══██╗ ╚██╔╝
# ██║ ██║╚██████╔╝██████╔╝ ██║
# ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝
# Ruby is a dynamic, reflective, object-oriented, general-purpose programming language
# ruby is a ruby interpreter
# invoke Ruby from the command line to run the script foo.rb
ruby foo.rb
# pass code as an argument
ruby -e 'puts "Hello world"'
# The -n switch acts as though the code you pass to Ruby was wrapped in the following:
# while gets
# # code here
# end
ruby -ne 'puts $_' file.txt
# The -p switch acts similarly to -n, in that it loops over each of the lines in the input
# after your code has finished, it always prints the value of $_
# Example: replace e with a
echo "eats, shoots, and leaves" | ruby -pe '$_.gsub!("e", "a")'
# BEGIN block executed before the loop
echo "foo\nbar\nbaz" | ruby -ne 'BEGIN { i = 1 }; puts "#{i} #{$_}"; i += 1'
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command ruby in a clear format. This allows users to quickly access the needed information for ruby without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for ruby are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.