linux-commands-guide 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- guia_linux/__init__.py +4 -0
- guia_linux/cli.py +89 -0
- guia_linux/tools/__init__.py +62 -0
- guia_linux/tools/awk.py +39 -0
- guia_linux/tools/cat.py +29 -0
- guia_linux/tools/chmod.py +28 -0
- guia_linux/tools/chown.py +22 -0
- guia_linux/tools/crontab.py +40 -0
- guia_linux/tools/curl.py +29 -0
- guia_linux/tools/cut.py +21 -0
- guia_linux/tools/df.py +30 -0
- guia_linux/tools/docker.py +39 -0
- guia_linux/tools/du.py +32 -0
- guia_linux/tools/file_descriptors.py +32 -0
- guia_linux/tools/find.py +38 -0
- guia_linux/tools/firewall_cmd.py +29 -0
- guia_linux/tools/free.py +26 -0
- guia_linux/tools/git.py +62 -0
- guia_linux/tools/grep.py +39 -0
- guia_linux/tools/head.py +23 -0
- guia_linux/tools/htop.py +25 -0
- guia_linux/tools/ifconfig.py +28 -0
- guia_linux/tools/ip.py +32 -0
- guia_linux/tools/iptables.py +30 -0
- guia_linux/tools/jq.py +32 -0
- guia_linux/tools/logs.py +48 -0
- guia_linux/tools/lsblk.py +29 -0
- guia_linux/tools/lsof.py +30 -0
- guia_linux/tools/lxc.py +24 -0
- guia_linux/tools/nc.py +27 -0
- guia_linux/tools/netstat.py +28 -0
- guia_linux/tools/nmap.py +33 -0
- guia_linux/tools/ps.py +30 -0
- guia_linux/tools/regex.py +38 -0
- guia_linux/tools/rsync.py +27 -0
- guia_linux/tools/scp.py +26 -0
- guia_linux/tools/sed.py +26 -0
- guia_linux/tools/shortcuts.py +32 -0
- guia_linux/tools/sort.py +24 -0
- guia_linux/tools/ss.py +32 -0
- guia_linux/tools/ssh.py +30 -0
- guia_linux/tools/system.py +54 -0
- guia_linux/tools/systemctl.py +34 -0
- guia_linux/tools/tail.py +25 -0
- guia_linux/tools/tar.py +27 -0
- guia_linux/tools/tee.py +20 -0
- guia_linux/tools/tmux.py +37 -0
- guia_linux/tools/top.py +34 -0
- guia_linux/tools/tr.py +23 -0
- guia_linux/tools/uname.py +24 -0
- guia_linux/tools/uniq.py +21 -0
- guia_linux/tools/vim.py +58 -0
- guia_linux/tools/watch.py +24 -0
- guia_linux/tools/xargs.py +23 -0
- guia_linux/utils.py +59 -0
- linux_commands_guide-2.0.0.dist-info/METADATA +147 -0
- linux_commands_guide-2.0.0.dist-info/RECORD +60 -0
- linux_commands_guide-2.0.0.dist-info/WHEEL +5 -0
- linux_commands_guide-2.0.0.dist-info/entry_points.txt +2 -0
- linux_commands_guide-2.0.0.dist-info/top_level.txt +1 -0
guia_linux/__init__.py
ADDED
guia_linux/cli.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import argparse
|
|
3
|
+
import sys
|
|
4
|
+
from shellcolorize import Color
|
|
5
|
+
from guia_linux.tools import TOOLS
|
|
6
|
+
from guia_linux.utils import search_all, strip_ansi
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _print_help(lang: str) -> None:
|
|
10
|
+
if lang == "en":
|
|
11
|
+
print(f"\n{Color.CYAN}{Color.BOLD}Linux Command Reference{Color.RESET} — usage:\n")
|
|
12
|
+
print(f" {Color.GREEN}lh{Color.RESET} <tool> Show commands for a tool")
|
|
13
|
+
print(f" {Color.GREEN}lh{Color.RESET} -s <keyword> Search across all tools")
|
|
14
|
+
print(f" {Color.GREEN}lh{Color.RESET} --lang en <tool> Force English output")
|
|
15
|
+
print(f" {Color.GREEN}lh{Color.RESET} --lang es <tool> Force Spanish output\n")
|
|
16
|
+
else:
|
|
17
|
+
print(f"\n{Color.CYAN}{Color.BOLD}Guía de Comandos Linux{Color.RESET} — uso:\n")
|
|
18
|
+
print(f" {Color.GREEN}lh{Color.RESET} <herramienta> Muestra comandos de una herramienta")
|
|
19
|
+
print(f" {Color.GREEN}lh{Color.RESET} -s <término> Busca en todas las herramientas")
|
|
20
|
+
print(f" {Color.GREEN}lh{Color.RESET} --lang en <tool> Fuerza salida en inglés")
|
|
21
|
+
print(f" {Color.GREEN}lh{Color.RESET} --lang es <tool> Fuerza salida en español\n")
|
|
22
|
+
|
|
23
|
+
label_tool = "Tool" if lang == "en" else "Herramienta"
|
|
24
|
+
label_desc = "Description" if lang == "en" else "Descripción"
|
|
25
|
+
print(f" {Color.YELLOW}{label_tool:<16}{label_desc}{Color.RESET}")
|
|
26
|
+
print(f" {'-' * 60}")
|
|
27
|
+
for name, module in sorted(TOOLS.items()):
|
|
28
|
+
desc = getattr(module, 'TITLE_EN' if lang == 'en' else 'TITLE', name.upper())
|
|
29
|
+
brief = getattr(module, 'BRIEF_EN' if lang == 'en' else 'BRIEF', '')
|
|
30
|
+
print(f" {Color.GREEN}{name:<16}{Color.RESET}{brief}")
|
|
31
|
+
print()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _search(query: str, lang: str) -> None:
|
|
35
|
+
results = search_all(query, TOOLS, lang)
|
|
36
|
+
desc_key = "description_en" if lang == "en" else "description"
|
|
37
|
+
if not results:
|
|
38
|
+
msg = f"No results for '{query}'" if lang == "en" else f"Sin resultados para '{query}'"
|
|
39
|
+
print(f"\n{Color.RED}{msg}{Color.RESET}\n")
|
|
40
|
+
return
|
|
41
|
+
|
|
42
|
+
header = f"Results for '{query}'" if lang == "en" else f"Resultados para '{query}'"
|
|
43
|
+
print(f"\n{Color.CYAN}{Color.BOLD}{header}{Color.RESET} ({len(results)}):\n")
|
|
44
|
+
current_tool = None
|
|
45
|
+
for tool_name, entry in results:
|
|
46
|
+
if tool_name != current_tool:
|
|
47
|
+
print(f"\n {Color.YELLOW}[{tool_name}]{Color.RESET}")
|
|
48
|
+
current_tool = tool_name
|
|
49
|
+
display = str(entry.get("command") or entry.get("logfile") or entry.get("pattern") or "")
|
|
50
|
+
desc = entry.get(desc_key, "")
|
|
51
|
+
clean = strip_ansi(display)
|
|
52
|
+
print(f" {Color.GREEN}{clean}{Color.RESET}")
|
|
53
|
+
print(f" {Color.RED}{desc}{Color.RESET}")
|
|
54
|
+
print()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def main() -> None:
|
|
58
|
+
parser = argparse.ArgumentParser(add_help=False)
|
|
59
|
+
parser.add_argument("tool", nargs="?", default=None)
|
|
60
|
+
parser.add_argument("-s", "--search", metavar="KEYWORD", default=None)
|
|
61
|
+
parser.add_argument("--lang", choices=["es", "en"], default="es")
|
|
62
|
+
parser.add_argument("-h", "--help", action="store_true")
|
|
63
|
+
args = parser.parse_args()
|
|
64
|
+
|
|
65
|
+
lang = args.lang
|
|
66
|
+
|
|
67
|
+
if args.help or (args.tool is None and args.search is None):
|
|
68
|
+
_print_help(lang)
|
|
69
|
+
return
|
|
70
|
+
|
|
71
|
+
if args.search:
|
|
72
|
+
_search(args.search, lang)
|
|
73
|
+
return
|
|
74
|
+
|
|
75
|
+
tool_key = args.tool.lower()
|
|
76
|
+
if tool_key not in TOOLS:
|
|
77
|
+
msg = (
|
|
78
|
+
f"Tool '{args.tool}' not found. Run 'lh --help' for the full list."
|
|
79
|
+
if lang == "en"
|
|
80
|
+
else f"Herramienta '{args.tool}' no encontrada. Ejecuta 'lh --help' para ver la lista."
|
|
81
|
+
)
|
|
82
|
+
print(f"\n{Color.RED}{msg}{Color.RESET}\n")
|
|
83
|
+
sys.exit(1)
|
|
84
|
+
|
|
85
|
+
TOOLS[tool_key].show(lang)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if __name__ == "__main__":
|
|
89
|
+
main()
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from guia_linux.tools import (
|
|
2
|
+
awk, cat, chmod, chown, crontab, curl, cut, df, docker, du,
|
|
3
|
+
file_descriptors, find, firewall_cmd, free, git, grep, head,
|
|
4
|
+
htop, ifconfig, ip, iptables, jq, logs, lsblk, lsof, lxc,
|
|
5
|
+
nc, netstat, nmap, ps, regex, rsync, scp, sed, shortcuts,
|
|
6
|
+
sort, ss, ssh, system, systemctl, tail, tar, tee, tmux,
|
|
7
|
+
top, tr, uname, uniq, vim, watch, xargs,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
TOOLS = {
|
|
11
|
+
"awk": awk,
|
|
12
|
+
"cat": cat,
|
|
13
|
+
"chmod": chmod,
|
|
14
|
+
"chown": chown,
|
|
15
|
+
"crontab": crontab,
|
|
16
|
+
"curl": curl,
|
|
17
|
+
"cut": cut,
|
|
18
|
+
"df": df,
|
|
19
|
+
"docker": docker,
|
|
20
|
+
"du": du,
|
|
21
|
+
"descriptors": file_descriptors,
|
|
22
|
+
"find": find,
|
|
23
|
+
"firewall-cmd": firewall_cmd,
|
|
24
|
+
"free": free,
|
|
25
|
+
"git": git,
|
|
26
|
+
"grep": grep,
|
|
27
|
+
"head": head,
|
|
28
|
+
"htop": htop,
|
|
29
|
+
"ifconfig": ifconfig,
|
|
30
|
+
"ip": ip,
|
|
31
|
+
"iptables": iptables,
|
|
32
|
+
"jq": jq,
|
|
33
|
+
"logs": logs,
|
|
34
|
+
"lsblk": lsblk,
|
|
35
|
+
"lsof": lsof,
|
|
36
|
+
"lxc": lxc,
|
|
37
|
+
"nc": nc,
|
|
38
|
+
"netstat": netstat,
|
|
39
|
+
"nmap": nmap,
|
|
40
|
+
"ps": ps,
|
|
41
|
+
"regex": regex,
|
|
42
|
+
"rsync": rsync,
|
|
43
|
+
"scp": scp,
|
|
44
|
+
"sed": sed,
|
|
45
|
+
"shortcuts": shortcuts,
|
|
46
|
+
"sort": sort,
|
|
47
|
+
"ss": ss,
|
|
48
|
+
"ssh": ssh,
|
|
49
|
+
"system": system,
|
|
50
|
+
"systemctl": systemctl,
|
|
51
|
+
"tail": tail,
|
|
52
|
+
"tar": tar,
|
|
53
|
+
"tee": tee,
|
|
54
|
+
"tmux": tmux,
|
|
55
|
+
"top": top,
|
|
56
|
+
"tr": tr,
|
|
57
|
+
"uname": uname,
|
|
58
|
+
"uniq": uniq,
|
|
59
|
+
"vim": vim,
|
|
60
|
+
"watch": watch,
|
|
61
|
+
"xargs": xargs,
|
|
62
|
+
}
|
guia_linux/tools/awk.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Opciones de AWK"
|
|
5
|
+
TITLE_EN = "AWK Options"
|
|
6
|
+
BRIEF = "Procesamiento de texto por columnas"
|
|
7
|
+
BRIEF_EN = "Column-based text processing"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{print $1}}' filename", "description": "Imprime la primera columna de cada línea", "description_en": "Print the first column of each line"},
|
|
11
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{print $1, $3}}' filename", "description": "Imprime la primera y tercera columna", "description_en": "Print the first and third columns"},
|
|
12
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '$3 > 100' filename", "description": "Imprime líneas donde la tercera columna > 100", "description_en": "Print lines where the third column > 100"},
|
|
13
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} -F',' '{{print $1}}' filename", "description": "Usa ',' como delimitador de campo", "description_en": "Use ',' as field delimiter"},
|
|
14
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} 'NR==5' filename", "description": "Imprime solo la quinta línea", "description_en": "Print only the fifth line"},
|
|
15
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} 'NR>5 && NR<10' filename", "description": "Imprime las líneas del 6 al 9", "description_en": "Print lines 6 through 9"},
|
|
16
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '/word/' filename", "description": "Imprime líneas que contienen 'word'", "description_en": "Print lines containing 'word'"},
|
|
17
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '!/word/' filename", "description": "Imprime líneas que NO contienen 'word'", "description_en": "Print lines NOT containing 'word'"},
|
|
18
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{sum+=$1}} END {{print sum}}' filename", "description": "Suma la primera columna", "description_en": "Sum the first column"},
|
|
19
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{count++}} END {{print count}}' filename", "description": "Cuenta el número de líneas", "description_en": "Count the number of lines"},
|
|
20
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} 'BEGIN {{print \"Start\"}}' filename", "description": "Imprime texto antes de procesar", "description_en": "Print text before processing"},
|
|
21
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} 'END {{print \"End\"}}' filename", "description": "Imprime texto después de procesar", "description_en": "Print text after processing"},
|
|
22
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{print NR, $0}}' filename", "description": "Imprime número de línea seguido de la línea completa", "description_en": "Print line number followed by full line"},
|
|
23
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{print NF}}' filename", "description": "Imprime el número de campos de cada línea", "description_en": "Print the number of fields per line"},
|
|
24
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '$1 ~ /regex/' filename", "description": "Imprime líneas donde el campo 1 coincide con regex", "description_en": "Print lines where field 1 matches regex"},
|
|
25
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} 'length($0) > 20' filename", "description": "Imprime líneas con más de 20 caracteres", "description_en": "Print lines longer than 20 characters"},
|
|
26
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{print tolower($0)}}' filename", "description": "Convierte a minúsculas", "description_en": "Convert to lowercase"},
|
|
27
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{print toupper($0)}}' filename", "description": "Convierte a mayúsculas", "description_en": "Convert to uppercase"},
|
|
28
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{sub(/old/,\"new\"); print}}' filename", "description": "Reemplaza la primera ocurrencia de 'old' por 'new'", "description_en": "Replace first occurrence of 'old' with 'new'"},
|
|
29
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{gsub(/old/,\"new\"); print}}' filename", "description": "Reemplaza todas las ocurrencias de 'old' por 'new'", "description_en": "Replace all occurrences of 'old' with 'new'"},
|
|
30
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{if ($1>50) print $1}}' filename", "description": "Imprime campo 1 solo si es mayor a 50", "description_en": "Print field 1 only if greater than 50"},
|
|
31
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} 'BEGIN {{OFS=\",\"}} {{print $1,$2}}' filename", "description": "Usa ',' como separador de salida", "description_en": "Use ',' as output field separator"},
|
|
32
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{total+=$3}} END {{print total/NR}}' filename", "description": "Calcula el promedio de la tercera columna", "description_en": "Calculate the average of the third column"},
|
|
33
|
+
{"command": f"{Color.GREEN}awk{Color.RESET} '{{if ($2>max) max=$2}} END {{print max}}' filename", "description": "Encuentra el valor máximo de la segunda columna", "description_en": "Find the maximum value of the second column"},
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def show(lang: str = "es") -> None:
|
|
38
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
39
|
+
print_table(title, COMMANDS, lang)
|
guia_linux/tools/cat.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Opciones de CAT"
|
|
5
|
+
TITLE_EN = "CAT Options"
|
|
6
|
+
BRIEF = "Muestra y concatena contenido de archivos"
|
|
7
|
+
BRIEF_EN = "Display and concatenate file contents"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} filename", "description": "Muestra el contenido del archivo", "description_en": "Display file contents"},
|
|
11
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} file1 file2 > output", "description": "Concatena file1 y file2 en output", "description_en": "Concatenate file1 and file2 into output"},
|
|
12
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} -n filename", "description": "Muestra el contenido con números de línea", "description_en": "Show content with line numbers"},
|
|
13
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} -b filename", "description": "Numera solo las líneas no vacías", "description_en": "Number only non-empty lines"},
|
|
14
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} -s filename", "description": "Suprime líneas vacías consecutivas", "description_en": "Squeeze consecutive blank lines"},
|
|
15
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} -T filename", "description": "Muestra tabulaciones como ^I", "description_en": "Show tabs as ^I"},
|
|
16
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} -E filename", "description": "Muestra $ al final de cada línea", "description_en": "Show $ at end of each line"},
|
|
17
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} -v filename", "description": "Muestra caracteres no imprimibles", "description_en": "Show non-printable characters"},
|
|
18
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} -A filename", "description": "Muestra todos los caracteres especiales", "description_en": "Show all special characters"},
|
|
19
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} -r, --line-range N:M filename", "description": "Muestra solo las líneas N a M (batcat)", "description_en": "Show only lines N to M (batcat)"},
|
|
20
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} --theme <theme>", "description": "Establece el tema de resaltado de sintaxis (batcat)", "description_en": "Set syntax-highlighting theme (batcat)"},
|
|
21
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} --paging never filename", "description": "Desactiva el paginador en batcat", "description_en": "Disable pager in batcat"},
|
|
22
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} -u, --unbuffered", "description": "Desactiva el buffering (compatibilidad POSIX)", "description_en": "Disable buffering (POSIX compatibility)"},
|
|
23
|
+
{"command": f"{Color.GREEN}cat{Color.RESET} -L, --list-languages", "description": "Lista los lenguajes soportados para resaltado", "description_en": "List supported syntax-highlighting languages"},
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def show(lang: str = "es") -> None:
|
|
28
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
29
|
+
print_table(title, COMMANDS, lang)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Opciones de CHMOD"
|
|
5
|
+
TITLE_EN = "CHMOD Options"
|
|
6
|
+
BRIEF = "Cambia permisos de archivos y directorios"
|
|
7
|
+
BRIEF_EN = "Change file and directory permissions"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} 755 filename", "description": "rwx para propietario, rx para grupo y otros", "description_en": "rwx for owner, rx for group and others"},
|
|
11
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} 644 filename", "description": "rw para propietario, r para grupo y otros", "description_en": "rw for owner, r for group and others"},
|
|
12
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} +x filename", "description": "Añade permiso de ejecución a todos", "description_en": "Add execute permission for everyone"},
|
|
13
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} -x filename", "description": "Revoca permiso de ejecución a todos", "description_en": "Remove execute permission for everyone"},
|
|
14
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} u+w filename", "description": "Añade escritura solo al propietario", "description_en": "Add write permission for owner only"},
|
|
15
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} g-w filename", "description": "Revoca escritura al grupo", "description_en": "Remove write permission from group"},
|
|
16
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} o+r filename", "description": "Añade lectura a otros", "description_en": "Add read permission for others"},
|
|
17
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} u=rwx,g=rx,o= filename", "description": "Permisos exactos para cada categoría", "description_en": "Set exact permissions per category"},
|
|
18
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} -R 755 directory", "description": "Aplica permisos recursivamente", "description_en": "Apply permissions recursively"},
|
|
19
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} a+x filename", "description": "Añade ejecución para todos (all)", "description_en": "Add execute for all (all)"},
|
|
20
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} ug=rw filename", "description": "Lectura y escritura para propietario y grupo", "description_en": "Read and write for owner and group"},
|
|
21
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} 400 filename", "description": "Solo lectura para el propietario", "description_en": "Read-only for owner"},
|
|
22
|
+
{"command": f"{Color.GREEN}chmod{Color.RESET} 777 filename", "description": "Todos los permisos para todos los usuarios", "description_en": "All permissions for all users"},
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def show(lang: str = "es") -> None:
|
|
27
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
28
|
+
print_table(title, COMMANDS, lang)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Opciones de CHOWN"
|
|
5
|
+
TITLE_EN = "CHOWN Options"
|
|
6
|
+
BRIEF = "Cambia propietario y grupo de archivos"
|
|
7
|
+
BRIEF_EN = "Change file owner and group"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"command": f"{Color.GREEN}chown{Color.RESET} user filename", "description": "Cambia el propietario a 'user'", "description_en": "Change owner to 'user'"},
|
|
11
|
+
{"command": f"{Color.GREEN}chown{Color.RESET} user:group filename", "description": "Cambia propietario y grupo", "description_en": "Change owner and group"},
|
|
12
|
+
{"command": f"{Color.GREEN}chown{Color.RESET} :group filename", "description": "Cambia solo el grupo", "description_en": "Change group only"},
|
|
13
|
+
{"command": f"{Color.GREEN}chown{Color.RESET} -R user directory", "description": "Cambia propietario recursivamente", "description_en": "Change owner recursively"},
|
|
14
|
+
{"command": f"{Color.GREEN}chown{Color.RESET} -R user:group directory", "description": "Cambia propietario y grupo recursivamente", "description_en": "Change owner and group recursively"},
|
|
15
|
+
{"command": f"{Color.GREEN}chown{Color.RESET} --from=old_user:new_user filename", "description": "Cambia solo si coincide con el propietario actual", "description_en": "Change only if current owner matches"},
|
|
16
|
+
{"command": f"{Color.GREEN}chown{Color.RESET} --reference=ref_file filename", "description": "Copia propietario y grupo de otro archivo", "description_en": "Copy owner and group from another file"},
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def show(lang: str = "es") -> None:
|
|
21
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
22
|
+
print_table(title, COMMANDS, lang)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Opciones de CRONTAB"
|
|
5
|
+
TITLE_EN = "CRONTAB Options"
|
|
6
|
+
BRIEF = "Programación de tareas periódicas"
|
|
7
|
+
BRIEF_EN = "Periodic task scheduling"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"section": "Gestión de crontab", "section_en": "Crontab Management"},
|
|
11
|
+
{"command": f"{Color.GREEN}crontab{Color.RESET} -e", "description": "Edita el crontab del usuario actual", "description_en": "Edit the current user's crontab"},
|
|
12
|
+
{"command": f"{Color.GREEN}crontab{Color.RESET} -l", "description": "Lista las tareas del crontab actual", "description_en": "List current crontab entries"},
|
|
13
|
+
{"command": f"{Color.GREEN}crontab{Color.RESET} -r", "description": "Elimina el crontab del usuario actual", "description_en": "Remove the current user's crontab"},
|
|
14
|
+
{"command": f"{Color.GREEN}crontab{Color.RESET} -u user -l", "description": "Lista el crontab de otro usuario (requiere root)", "description_en": "List another user's crontab (requires root)"},
|
|
15
|
+
{"command": f"{Color.GREEN}crontab{Color.RESET} file.cron", "description": "Instala un crontab desde un archivo", "description_en": "Install a crontab from a file"},
|
|
16
|
+
|
|
17
|
+
{"section": "Sintaxis de los campos [min hora día mes día_semana]", "section_en": "Field Syntax [min hour day month weekday]"},
|
|
18
|
+
{"command": f"{Color.YELLOW}* * * * *{Color.RESET} command", "description": "Ejecuta cada minuto", "description_en": "Run every minute"},
|
|
19
|
+
{"command": f"{Color.YELLOW}0 * * * *{Color.RESET} command", "description": "Ejecuta cada hora (al minuto 0)", "description_en": "Run every hour (at minute 0)"},
|
|
20
|
+
{"command": f"{Color.YELLOW}0 0 * * *{Color.RESET} command", "description": "Ejecuta cada día a medianoche", "description_en": "Run every day at midnight"},
|
|
21
|
+
{"command": f"{Color.YELLOW}0 9 * * 1{Color.RESET} command", "description": "Ejecuta cada lunes a las 9:00", "description_en": "Run every Monday at 9:00"},
|
|
22
|
+
{"command": f"{Color.YELLOW}0 0 1 * *{Color.RESET} command", "description": "Ejecuta el primer día de cada mes", "description_en": "Run on the first day of every month"},
|
|
23
|
+
{"command": f"{Color.YELLOW}*/15 * * * *{Color.RESET} command", "description": "Ejecuta cada 15 minutos", "description_en": "Run every 15 minutes"},
|
|
24
|
+
{"command": f"{Color.YELLOW}0 8-18 * * 1-5{Color.RESET} command", "description": "Ejecuta cada hora de 8 a 18, de lunes a viernes", "description_en": "Run hourly from 8 to 18, Monday to Friday"},
|
|
25
|
+
{"command": f"{Color.YELLOW}30 23 * * 0,6{Color.RESET} command", "description": "Ejecuta a las 23:30 los sábados y domingos", "description_en": "Run at 23:30 on Saturdays and Sundays"},
|
|
26
|
+
|
|
27
|
+
{"section": "Variables especiales", "section_en": "Special Variables"},
|
|
28
|
+
{"command": f"{Color.GREEN}MAILTO{Color.RESET}=user@example.com", "description": "Envía la salida por correo al usuario especificado", "description_en": "Send output by email to the specified user"},
|
|
29
|
+
{"command": f"{Color.GREEN}PATH{Color.RESET}=/usr/local/bin:/usr/bin:/bin", "description": "Define el PATH para los comandos del crontab", "description_en": "Set PATH for crontab commands"},
|
|
30
|
+
{"command": f"{Color.GREEN}@reboot{Color.RESET} command", "description": "Ejecuta el comando al arrancar el sistema", "description_en": "Run command at system boot"},
|
|
31
|
+
{"command": f"{Color.GREEN}@hourly{Color.RESET} command", "description": "Alias de '0 * * * *'", "description_en": "Alias for '0 * * * *'"},
|
|
32
|
+
{"command": f"{Color.GREEN}@daily{Color.RESET} command", "description": "Alias de '0 0 * * *'", "description_en": "Alias for '0 0 * * *'"},
|
|
33
|
+
{"command": f"{Color.GREEN}@weekly{Color.RESET} command", "description": "Alias de '0 0 * * 0'", "description_en": "Alias for '0 0 * * 0'"},
|
|
34
|
+
{"command": f"{Color.GREEN}@monthly{Color.RESET} command", "description": "Alias de '0 0 1 * *'", "description_en": "Alias for '0 0 1 * *'"},
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def show(lang: str = "es") -> None:
|
|
39
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
40
|
+
print_table(title, COMMANDS, lang)
|
guia_linux/tools/curl.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Opciones de CURL"
|
|
5
|
+
TITLE_EN = "CURL Options"
|
|
6
|
+
BRIEF = "Transfiere datos con URLs"
|
|
7
|
+
BRIEF_EN = "Transfer data with URLs"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} https://example.com", "description": "Realiza una petición HTTP GET", "description_en": "Perform an HTTP GET request"},
|
|
11
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -I https://example.com", "description": "Muestra solo los encabezados de respuesta (HEAD)", "description_en": "Show only response headers (HEAD)"},
|
|
12
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -o file.txt https://example.com/file", "description": "Guarda la respuesta en un archivo", "description_en": "Save response to a file"},
|
|
13
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -O https://example.com/file.zip", "description": "Guarda con el nombre original del archivo", "description_en": "Save with the original filename"},
|
|
14
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -L https://example.com", "description": "Sigue redirecciones HTTP", "description_en": "Follow HTTP redirects"},
|
|
15
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -u user:pass https://example.com", "description": "Autenticación básica HTTP", "description_en": "HTTP basic authentication"},
|
|
16
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -d 'key=value' https://example.com", "description": "Envía datos POST", "description_en": "Send POST data"},
|
|
17
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -H 'Content-Type: application/json' URL", "description": "Añade una cabecera personalizada", "description_en": "Add a custom request header"},
|
|
18
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -X PUT https://example.com", "description": "Usa el método HTTP especificado", "description_en": "Use the specified HTTP method"},
|
|
19
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -s https://example.com", "description": "Modo silencioso — sin barra de progreso", "description_en": "Silent mode — no progress bar"},
|
|
20
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -v https://example.com", "description": "Modo verbose — muestra detalles de la conexión", "description_en": "Verbose mode — show connection details"},
|
|
21
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -k https://self-signed.example.com", "description": "Acepta certificados SSL no verificados", "description_en": "Accept unverified SSL certificates"},
|
|
22
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} --limit-rate 100K https://example.com", "description": "Limita la velocidad de transferencia", "description_en": "Limit transfer speed"},
|
|
23
|
+
{"command": f"{Color.GREEN}curl{Color.RESET} -x proxy:8080 https://example.com", "description": "Usa un proxy HTTP", "description_en": "Use an HTTP proxy"},
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def show(lang: str = "es") -> None:
|
|
28
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
29
|
+
print_table(title, COMMANDS, lang)
|
guia_linux/tools/cut.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Opciones de CUT"
|
|
5
|
+
TITLE_EN = "CUT Options"
|
|
6
|
+
BRIEF = "Extrae secciones de cada línea"
|
|
7
|
+
BRIEF_EN = "Extract sections from each line"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"command": f"{Color.GREEN}cut{Color.RESET} -d',' -f2 filename", "description": "Extrae la 2ª columna usando ',' como delimitador", "description_en": "Extract 2nd column using ',' as delimiter"},
|
|
11
|
+
{"command": f"{Color.GREEN}cut{Color.RESET} -f1,3 filename", "description": "Extrae la 1ª y 3ª columna (tabulación)", "description_en": "Extract 1st and 3rd column (tab-delimited)"},
|
|
12
|
+
{"command": f"{Color.GREEN}cut{Color.RESET} -c1-5 filename", "description": "Extrae los primeros 5 caracteres de cada línea", "description_en": "Extract the first 5 characters of each line"},
|
|
13
|
+
{"command": f"{Color.GREEN}cut{Color.RESET} -d':' -f1 /etc/passwd", "description": "Extrae el primer campo de /etc/passwd", "description_en": "Extract the first field from /etc/passwd"},
|
|
14
|
+
{"command": f"{Color.GREEN}cut{Color.RESET} -d' ' -f1-3 filename", "description": "Extrae los tres primeros campos separados por espacio", "description_en": "Extract the first three space-separated fields"},
|
|
15
|
+
{"command": f"{Color.GREEN}cut{Color.RESET} -s -d',' -f2 filename", "description": "Muestra solo líneas que contienen el delimitador", "description_en": "Show only lines containing the delimiter"},
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def show(lang: str = "es") -> None:
|
|
20
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
21
|
+
print_table(title, COMMANDS, lang)
|
guia_linux/tools/df.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Opciones de DF"
|
|
5
|
+
TITLE_EN = "DF Options"
|
|
6
|
+
BRIEF = "Muestra el uso de espacio en disco"
|
|
7
|
+
BRIEF_EN = "Display disk space usage"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"command": f"{Color.GREEN}df{Color.RESET}", "description": "Muestra el espacio en disco de todos los sistemas de archivos", "description_en": "Show disk space for all filesystems"},
|
|
11
|
+
{"command": f"{Color.GREEN}df{Color.RESET} -h", "description": "Formato legible (KB, MB, GB)", "description_en": "Human-readable format (KB, MB, GB)"},
|
|
12
|
+
{"command": f"{Color.GREEN}df{Color.RESET} -H", "description": "Formato legible usando potencias de 1000", "description_en": "Human-readable using powers of 1000"},
|
|
13
|
+
{"command": f"{Color.GREEN}df{Color.RESET} -a", "description": "Incluye sistemas de archivos de tamaño 0", "description_en": "Include 0-block filesystems"},
|
|
14
|
+
{"command": f"{Color.GREEN}df{Color.RESET} -T", "description": "Muestra el tipo de sistema de archivos", "description_en": "Show filesystem type"},
|
|
15
|
+
{"command": f"{Color.GREEN}df{Color.RESET} -t TYPE", "description": "Muestra solo sistemas de archivos del tipo indicado", "description_en": "Show only filesystems of the given type"},
|
|
16
|
+
{"command": f"{Color.GREEN}df{Color.RESET} -x TYPE", "description": "Excluye sistemas de archivos del tipo indicado", "description_en": "Exclude filesystems of the given type"},
|
|
17
|
+
{"command": f"{Color.GREEN}df{Color.RESET} -i", "description": "Muestra uso de inodos en lugar de bloques", "description_en": "Show inode usage instead of blocks"},
|
|
18
|
+
{"command": f"{Color.GREEN}df{Color.RESET} --total", "description": "Añade una línea con el total al final", "description_en": "Add a grand total line"},
|
|
19
|
+
{"command": f"{Color.GREEN}df{Color.RESET} -l", "description": "Muestra solo sistemas de archivos locales", "description_en": "Show only local filesystems"},
|
|
20
|
+
{"command": f"{Color.GREEN}df{Color.RESET} --output=source,size,used,avail", "description": "Muestra solo los campos especificados", "description_en": "Show only the specified fields"},
|
|
21
|
+
{"command": f"{Color.GREEN}df{Color.RESET} --block-size=1M", "description": "Muestra tamaños en bloques de 1 MB", "description_en": "Show sizes in 1 MB blocks"},
|
|
22
|
+
{"command": f"{Color.GREEN}df{Color.RESET} -k", "description": "Muestra tamaños en bloques de 1024 bytes", "description_en": "Show sizes in 1024-byte blocks"},
|
|
23
|
+
{"command": f"{Color.GREEN}df{Color.RESET} -m", "description": "Muestra tamaños en megabytes", "description_en": "Show sizes in megabytes"},
|
|
24
|
+
{"command": f"{Color.GREEN}df{Color.RESET} --inodes", "description": "Muestra información de inodos", "description_en": "Show inode information"},
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def show(lang: str = "es") -> None:
|
|
29
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
30
|
+
print_table(title, COMMANDS, lang)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Opciones de DOCKER"
|
|
5
|
+
TITLE_EN = "DOCKER Options"
|
|
6
|
+
BRIEF = "Gestión de contenedores Docker"
|
|
7
|
+
BRIEF_EN = "Docker container management"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} ps", "description": "Lista los contenedores en ejecución", "description_en": "List running containers"},
|
|
11
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} ps -a", "description": "Lista todos los contenedores (incluidos detenidos)", "description_en": "List all containers (including stopped)"},
|
|
12
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} images", "description": "Lista todas las imágenes disponibles", "description_en": "List all available images"},
|
|
13
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} run image_name", "description": "Inicia un contenedor desde la imagen", "description_en": "Start a container from an image"},
|
|
14
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} run -d image_name", "description": "Inicia un contenedor en segundo plano", "description_en": "Start a container in background (detached)"},
|
|
15
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} run -it image_name bash", "description": "Inicia un contenedor interactivo con shell", "description_en": "Start an interactive container with shell"},
|
|
16
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} run -p 8080:80 image_name", "description": "Mapea puerto del host al contenedor", "description_en": "Map host port to container port"},
|
|
17
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} start container_id", "description": "Inicia un contenedor detenido", "description_en": "Start a stopped container"},
|
|
18
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} stop container_id", "description": "Detiene un contenedor en ejecución", "description_en": "Stop a running container"},
|
|
19
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} restart container_id", "description": "Reinicia un contenedor", "description_en": "Restart a container"},
|
|
20
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} rm container_id", "description": "Elimina un contenedor detenido", "description_en": "Remove a stopped container"},
|
|
21
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} rmi image_id", "description": "Elimina una imagen", "description_en": "Remove an image"},
|
|
22
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} pull image_name", "description": "Descarga una imagen desde Docker Hub", "description_en": "Pull an image from Docker Hub"},
|
|
23
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} build -t name .", "description": "Construye una imagen desde un Dockerfile", "description_en": "Build an image from a Dockerfile"},
|
|
24
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} exec -it container_id bash", "description": "Ejecuta un shell interactivo en el contenedor", "description_en": "Run an interactive shell inside a container"},
|
|
25
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} logs container_id", "description": "Muestra los logs de un contenedor", "description_en": "Show container logs"},
|
|
26
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} logs -f container_id", "description": "Sigue los logs en tiempo real", "description_en": "Follow container logs in real time"},
|
|
27
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} inspect container_id", "description": "Muestra información detallada del contenedor", "description_en": "Show detailed container information"},
|
|
28
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} network ls", "description": "Lista las redes de Docker", "description_en": "List Docker networks"},
|
|
29
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} volume ls", "description": "Lista los volúmenes de Docker", "description_en": "List Docker volumes"},
|
|
30
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} system prune", "description": "Limpia recursos no utilizados", "description_en": "Remove unused containers, images, and networks"},
|
|
31
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} stats", "description": "Muestra el uso de recursos en tiempo real", "description_en": "Show live resource usage stats"},
|
|
32
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} compose up -d", "description": "Lanza servicios definidos en docker-compose.yml", "description_en": "Start services defined in docker-compose.yml"},
|
|
33
|
+
{"command": f"{Color.GREEN}docker{Color.RESET} compose down", "description": "Detiene y elimina los servicios de compose", "description_en": "Stop and remove compose services"},
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def show(lang: str = "es") -> None:
|
|
38
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
39
|
+
print_table(title, COMMANDS, lang)
|
guia_linux/tools/du.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Opciones de DU"
|
|
5
|
+
TITLE_EN = "DU Options"
|
|
6
|
+
BRIEF = "Muestra el uso de espacio de directorios"
|
|
7
|
+
BRIEF_EN = "Display directory space usage"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"command": f"{Color.GREEN}du{Color.RESET}", "description": "Muestra el tamaño de archivos y directorios actuales", "description_en": "Show size of files and directories"},
|
|
11
|
+
{"command": f"{Color.GREEN}du{Color.RESET} -a", "description": "Incluye archivos individuales en la salida", "description_en": "Include individual files in output"},
|
|
12
|
+
{"command": f"{Color.GREEN}du{Color.RESET} -h", "description": "Formato legible (KB, MB, GB)", "description_en": "Human-readable format (KB, MB, GB)"},
|
|
13
|
+
{"command": f"{Color.GREEN}du{Color.RESET} -s", "description": "Muestra solo el total de cada argumento", "description_en": "Show only the total for each argument"},
|
|
14
|
+
{"command": f"{Color.GREEN}du{Color.RESET} -c", "description": "Muestra un total acumulado al final", "description_en": "Show a grand total at the end"},
|
|
15
|
+
{"command": f"{Color.GREEN}du{Color.RESET} -k", "description": "Muestra tamaños en bloques de 1024 bytes", "description_en": "Show sizes in 1024-byte blocks"},
|
|
16
|
+
{"command": f"{Color.GREEN}du{Color.RESET} -m", "description": "Muestra tamaños en megabytes", "description_en": "Show sizes in megabytes"},
|
|
17
|
+
{"command": f"{Color.GREEN}du{Color.RESET} -b", "description": "Muestra tamaños en bytes", "description_en": "Show sizes in bytes"},
|
|
18
|
+
{"command": f"{Color.GREEN}du{Color.RESET} -L", "description": "Sigue enlaces simbólicos", "description_en": "Follow symbolic links"},
|
|
19
|
+
{"command": f"{Color.GREEN}du{Color.RESET} -x", "description": "Omite directorios en otros sistemas de archivos", "description_en": "Skip directories on other filesystems"},
|
|
20
|
+
{"command": f"{Color.GREEN}du{Color.RESET} -d N", "description": "Muestra hasta N niveles de profundidad", "description_en": "Show up to N levels of depth"},
|
|
21
|
+
{"command": f"{Color.GREEN}du{Color.RESET} --max-depth=N", "description": "Similar a -d N", "description_en": "Same as -d N"},
|
|
22
|
+
{"command": f"{Color.GREEN}du{Color.RESET} --threshold=SIZE", "description": "Muestra solo entradas mayores o iguales a SIZE", "description_en": "Show only entries >= SIZE"},
|
|
23
|
+
{"command": f"{Color.GREEN}du{Color.RESET} --exclude=PATTERN", "description": "Excluye archivos que coincidan con PATTERN", "description_en": "Exclude files matching PATTERN"},
|
|
24
|
+
{"command": f"{Color.GREEN}du{Color.RESET} --apparent-size", "description": "Muestra el tamaño aparente en lugar de bloques usados", "description_en": "Show apparent size instead of disk usage"},
|
|
25
|
+
{"command": f"{Color.GREEN}du{Color.RESET} --inodes", "description": "Cuenta inodos en lugar de tamaño", "description_en": "Count inodes instead of size"},
|
|
26
|
+
{"command": f"{Color.GREEN}du{Color.RESET} --time", "description": "Muestra la fecha de última modificación", "description_en": "Show last modification time"},
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def show(lang: str = "es") -> None:
|
|
31
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
32
|
+
print_table(title, COMMANDS, lang)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Descriptores de Archivo y Redirecciones"
|
|
5
|
+
TITLE_EN = "File Descriptors and Redirections"
|
|
6
|
+
BRIEF = "Redirecciones de stdin, stdout y stderr"
|
|
7
|
+
BRIEF_EN = "stdin, stdout and stderr redirections"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"command": f"{Color.GREEN}command{Color.RESET} > file", "description": "Redirige stdout a un archivo (sobreescribe)", "description_en": "Redirect stdout to file (overwrite)"},
|
|
11
|
+
{"command": f"{Color.GREEN}command{Color.RESET} >> file", "description": "Agrega stdout al final de un archivo", "description_en": "Append stdout to file"},
|
|
12
|
+
{"command": f"{Color.GREEN}command{Color.RESET} 2> file", "description": "Redirige stderr a un archivo", "description_en": "Redirect stderr to file"},
|
|
13
|
+
{"command": f"{Color.GREEN}command{Color.RESET} 2>> file", "description": "Agrega stderr al final de un archivo", "description_en": "Append stderr to file"},
|
|
14
|
+
{"command": f"{Color.GREEN}command{Color.RESET} > file 2>&1", "description": "Redirige stdout y stderr al mismo archivo", "description_en": "Redirect both stdout and stderr to file"},
|
|
15
|
+
{"command": f"{Color.GREEN}command{Color.RESET} &> file", "description": "Redirige stdout y stderr (forma corta)", "description_en": "Redirect stdout and stderr (shorthand)"},
|
|
16
|
+
{"command": f"{Color.GREEN}command{Color.RESET} < file", "description": "Usa un archivo como stdin", "description_en": "Use file as stdin"},
|
|
17
|
+
{"command": f"{Color.GREEN}command{Color.RESET} 2> /dev/null", "description": "Descarta stderr", "description_en": "Discard stderr"},
|
|
18
|
+
{"command": f"{Color.GREEN}command{Color.RESET} > /dev/null", "description": "Descarta stdout", "description_en": "Discard stdout"},
|
|
19
|
+
{"command": f"{Color.GREEN}command{Color.RESET} > /dev/null 2>&1", "description": "Descarta stdout y stderr", "description_en": "Discard both stdout and stderr"},
|
|
20
|
+
{"command": f"{Color.GREEN}command{Color.RESET} 3> file", "description": "Redirige el descriptor 3 a un archivo", "description_en": "Redirect file descriptor 3 to file"},
|
|
21
|
+
{"command": f"{Color.GREEN}command{Color.RESET} 3>&-", "description": "Cierra el descriptor de archivo 3", "description_en": "Close file descriptor 3"},
|
|
22
|
+
{"command": f"{Color.GREEN}exec{Color.RESET} 3> file", "description": "Abre el descriptor 3 para escritura", "description_en": "Open fd 3 for writing"},
|
|
23
|
+
{"command": f"{Color.GREEN}exec{Color.RESET} 3< file", "description": "Abre el descriptor 3 para lectura", "description_en": "Open fd 3 for reading"},
|
|
24
|
+
{"command": f"{Color.GREEN}command1{Color.RESET} | command2", "description": "Conecta stdout de command1 a stdin de command2", "description_en": "Pipe stdout of command1 to stdin of command2"},
|
|
25
|
+
{"command": f"{Color.GREEN}command{Color.RESET} | tee file", "description": "Escribe stdout en un archivo y en pantalla", "description_en": "Write stdout to file and screen simultaneously"},
|
|
26
|
+
{"command": f"{Color.GREEN}command{Color.RESET} | tee -a file", "description": "Agrega stdout al archivo y lo muestra en pantalla", "description_en": "Append stdout to file and display on screen"},
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def show(lang: str = "es") -> None:
|
|
31
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
32
|
+
print_table(title, COMMANDS, lang)
|
guia_linux/tools/find.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from shellcolorize import Color
|
|
2
|
+
from guia_linux.utils import print_table
|
|
3
|
+
|
|
4
|
+
TITLE = "Opciones de FIND"
|
|
5
|
+
TITLE_EN = "FIND Options"
|
|
6
|
+
BRIEF = "Busca archivos y directorios"
|
|
7
|
+
BRIEF_EN = "Search for files and directories"
|
|
8
|
+
|
|
9
|
+
COMMANDS = [
|
|
10
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path", "description": "Busca todos los archivos y directorios en la ruta", "description_en": "List all files and directories under path"},
|
|
11
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -name 'file'", "description": "Busca por nombre exacto", "description_en": "Search by exact name"},
|
|
12
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -iname 'file'", "description": "Busca por nombre ignorando mayúsculas", "description_en": "Case-insensitive name search"},
|
|
13
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -type f", "description": "Busca solo archivos", "description_en": "Find regular files only"},
|
|
14
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -type d", "description": "Busca solo directorios", "description_en": "Find directories only"},
|
|
15
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -size +100M", "description": "Busca archivos mayores de 100 MB", "description_en": "Find files larger than 100 MB"},
|
|
16
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -size -100M", "description": "Busca archivos menores de 100 MB", "description_en": "Find files smaller than 100 MB"},
|
|
17
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -mtime -7", "description": "Archivos modificados en los últimos 7 días", "description_en": "Files modified in the last 7 days"},
|
|
18
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -atime -7", "description": "Archivos accedidos en los últimos 7 días", "description_en": "Files accessed in the last 7 days"},
|
|
19
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -mmin -30", "description": "Archivos modificados en los últimos 30 minutos", "description_en": "Files modified in the last 30 minutes"},
|
|
20
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -user username", "description": "Archivos pertenecientes a un usuario", "description_en": "Files owned by a specific user"},
|
|
21
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -group groupname", "description": "Archivos pertenecientes a un grupo", "description_en": "Files belonging to a group"},
|
|
22
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -perm 755", "description": "Archivos con permisos exactos 755", "description_en": "Files with exact permissions 755"},
|
|
23
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -empty", "description": "Archivos o directorios vacíos", "description_en": "Find empty files or directories"},
|
|
24
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -exec cmd {{}} \\;", "description": "Ejecuta un comando en cada resultado", "description_en": "Execute a command on each result"},
|
|
25
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -delete", "description": "Elimina los archivos encontrados", "description_en": "Delete found files"},
|
|
26
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -name '*.txt' -o -name '*.log'", "description": "Busca archivos .txt o .log", "description_en": "Find .txt or .log files"},
|
|
27
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -not -name '*.txt'", "description": "Excluye archivos con el nombre especificado", "description_en": "Exclude files matching name"},
|
|
28
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -maxdepth 2", "description": "Limita la búsqueda a 2 niveles de profundidad", "description_en": "Limit search depth to 2 levels"},
|
|
29
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -mindepth 2", "description": "Omite los primeros 2 niveles de profundidad", "description_en": "Skip the first 2 directory levels"},
|
|
30
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -newer file", "description": "Archivos más recientes que 'file'", "description_en": "Files newer than 'file'"},
|
|
31
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -type f -exec chmod 644 {{}} \\;", "description": "Cambia permisos de archivos encontrados a 644", "description_en": "Set permissions of found files to 644"},
|
|
32
|
+
{"command": f"{Color.GREEN}find{Color.RESET} /path -type f -print0 | xargs -0 grep 'pat'", "description": "Busca un patrón en el contenido de los archivos", "description_en": "Search for a pattern inside found files"},
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def show(lang: str = "es") -> None:
|
|
37
|
+
title = TITLE_EN if lang == "en" else TITLE
|
|
38
|
+
print_table(title, COMMANDS, lang)
|