I am trying to make a simple program in c that enters a specific folder I made in my home directory, clears the terminal screen and lists what's in the folder:
#include <stdlib.h>
void main()
{
system("cd");
system("cd Desktop");
system("clear");
system("ls");
}
When I compile and run it, it lists everything in my home directory an doesn't move to the folder I specified. I am trying to make a script I can run in my terminal from anywhere to get to my folder dedicated for work (I'm lazy), so I would also like to know how to make it a command in my terminal (like you type cd in no mater what directory you are and it does what you want it to do).
Sorry for putting two questions here, but they feel somewhat related.