TGViewer
Linux - Reddit Linux - Reddit @r_linux · 1.05K subscribers
Post #43111 32
Project TuxExec - Lightweight Linux CLI Management Tool Written in C

This is the 0.001 TuxExec, Opensource

\#include <stdio.h>

\#include <unistd.h>

\#include <sys/types.h>

\#include <sys/wait.h>

\#include <stdlib.h>

\#include <string.h>



void input_cmd(char *buf, size_t size)

{

printf("TuxExec: ");

if (fgets(buf, size, stdin) != NULL) {

buf[strcspn(buf, "\\n")\] = '\\0';

}

}



void wslinstubuntu(void)

{

system("wsl --install -d Ubuntu");

printf("window fuckass using wsl btw =)) ");

}



void inst(void)

{

char pkgmn[256\];

printf("Linux pkgmn = ? (pacman ,apt , dnf): ");

fgets(pkgmn, sizeof(pkgmn), stdin);

pkgmn[strcspn(pkgmn, "\\n")\] = '\\0';



if (strcmp(pkgmn, "apt") == 0) {

while(1) {

char apt[512\];



printf("pkg install: ");

fgets(apt, sizeof(apt), stdin);



apt[strcspn(apt, "\\n")\] = '\\0';



pid_t pid = fork();

if (pid < 0) {

perror("du me hu fork roi huhu");

}

else if (pid == 0) {

char *args[\] = {"sudo", "apt", "install", apt, NULL};

execvp(args[0\], args);

perror("dit cu loi roi bro oi");

exit(1);

}

else {

wait(NULL);

}

}

}

else if (strcmp(pkgmn, "dnf") == 0) {

while(1) {

char dnf[512\];



printf("pkg install: ");

fgets(dnf, sizeof(dnf), stdin);



dnf[strcspn(dnf, "\\n")\] = '\\0';



pid_t pid = fork();

if (pid < 0) {

perror("dit cu loi tiep");

}

else if (pid == 0) {

char *args[\] = {"sudo", "dnf", "install", dnf, NULL};

execvp(args[0\], args);

perror(" dit cu hu roi");

exit(1);

}

else {

wait(NULL);

}

}

}

else if (strcmp(pkgmn, "pacman") == 0) {

char pacman[512\];



printf("pkg install: ");

fgets(pacman, sizeof(pacman), stdin);



pacman[strcspn(pacman, "\\n")\] = '\\0';



pid_t pid = fork();

if (pid < 0) {

perror(" loi roi huh");

}

else if (pid == 0) {

char *args[\] = {"sudo", "pacman", "-S", pacman, NULL};

execvp(args[0\], args);

perror("dit cu loi roi");

exit(1);

}

else {

wait(NULL);

}

}

}



void rm(void)

{

char rm_file[80\];

printf("file want to remove ? ");

fgets(rm_file, sizeof(rm_file), stdin);



rm_file[strcspn(rm_file, "\\n")\] = '\\0';



char sure[10\];

printf("Sure ? Y/n : ");

fgets(sure, sizeof(sure), stdin);



sure[strcspn(sure, "\\n")\] = '\\0';



if (strcmp(sure, "y") == 0 || strcmp(sure, "Y") == 0) {

pid_t pid = fork();

if (pid == 0) {

char *args[\] = {"sudo", "rm", rm_file, NULL};

execvp(args[0\], args);

perror("failed execvp");

exit(1);

}

else {

wait(NULL);

}

} else {

return;

}

}



void systeminfo(void)

{

pid_t pid = fork();

if (pid == 0) {

char *args[\] = {"sh", "-c", "ls && lsblk && ls /", NULL};

execvp(args[0\], args);

perror("failed execvp");

exit(0);

}

else {

wait(NULL);

}

}



void rep(void)

{

while(1) {

char rep_cmd[50\];

printf(" what do you want?\\n"

"<how to see info of system linux>\\n"

"<how to get remove file in this system>\\n"

"<how to get install pkg>\\n"

"<how to install wsl in this system \\\\ powershell>: ");

fgets(rep_cmd, sizeof(rep_cmd), stdin);



rep_cmd[strcspn(rep_cmd, "\\n")\] = '\\0';



if (strcmp(rep_cmd, "how to see info of system linux") == 0) {

printf("in your terminal , getting command ls, lsblk, ls /, whoami, in this system, you command the systeminfo\\n");

} else if (strcmp(rep_cmd, "how to get remove file in this system") == 0) {

printf(" in your terminal, getting command rm and your file path wanted to remove, in this system you command rm and write the path file\\n");

} else if (strcmp(rep_cmd, "how to get install pkg") == 0) {

printf("sudo and your pkg and your pkg , in this system, just command inst and select pkgmanager, select pkg\\n");

} else if (strcmp(rep_cmd, "how to install wsl in this system \\\\ powershell") == 0) {

printf(" you really use window bruhhh haha, just command wsl --install Ubuntu or in this system, just command wslinstubuntu\\n");

} else {

exit(0);

}

}

}



int main(void) {

char user_input[256\];



while(1) {

input_cmd(user_input, sizeof(user_input));



if (strcmp(user_input, "wslinstubuntu") == 0) {

wslinstubuntu();

}
More from @r_linux
  1. Oct 4, 2026Introducing MobiXournal: A native, stylus-first Xournal++ (.xopp) editor with full round-t…
  2. Oct 4, 2026Brazil election - 560K devices, the most fast e electronic election https://redd.it/1wxjix…
  3. Oct 4, 2026Mesa 26.3 Enables Intel's New Jay Shader Compiler By Default, Compile Times 55% Faster Or…
  4. Oct 4, 2026[App] Whisp v1.6.0 Universal launch shortcut and Bug fixes https://redd.it/1wxfpou @r_linu…
  5. Oct 4, 2026European Citizens' Initiative https://eci.ec.europa.eu/066/public/#/screen/home https://re…
  6. Oct 4, 2026Linux 7.2.2 on iPhone XS? First boot! https://i.redd.it/9ub3aiohspsh1.gif https://redd.it/…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →