How do you go to a local directory in PuTTy? - shell

I'm not used to using PuTTy so I'm not very well versed with all the know hows to use it. So after I log onto the HostName/IP address and log in with my username and ID, there's a local directory /u/SysLab/ where one of the file belongs to me and that's where I'm supposed to do my coding, but I'm not sure how to access it, can anyone tell me how to do this? Me googling "How to go to local directory" yields questions that ask how to transfer files to the server, which isn't what I want to do. I just want to go into the directory and start my coding homework. Can anyone help me?

Did you try cd /u/SysLab?
That should change your current directory to /u/SysLab/ after that you should be able to open the file that you want to work on using some editor e.g. if use Emacs then you could do emacs -nw <yourfile>.

I strongly recommend to first get familiar with (at least) some basic navigation and file handling/editing in the terminal before starting to code.
Assuming your OS is Linux/Unix based, cd (change directory) and the path should work for you: cd /u/SysLab

Related

Change directory where git bash launches without shortcut or modifying $HOME

The company I work for has a code repository deep within a folder structure, the path of which I have saved in a text file. As I was copying that path from notepad++ and pasting it into a cd command for the hundredth time after launching git bash I began to get the feeling that I was wasting time. Being the good programmer that I am, spending an hour researching how to do something programmatically is obviously preferable to doing something that takes four seconds over and over again. However I have been disappointed to find that all of the readily-available solutions offer one of two recommendations which both feel more like workarounds than an actual config change:
Create a shortcut and modify the "start in" field. This is not acceptable for me because I launch git from the start menu (windows key + type "git"). I don't want to add the extra steps of navigating to the folder where I created the shortcut. Even if I give the shortcut a unique name such as "stupidshortcutname", I am not able to access this shortcut by searching in the windows start menu.
Modify the Windows environment variable HOME. This is not acceptable because I still want cmd to launch in its default location of C:\Users\MyUserNameHere.
With some further research I also found the option of creating a file called .bashrc in my C:\Users\MyUserNameHere directory, and having this run cd <folder I want to go to>, but this still feels pretty hacky for something that I feel should be a configuration somewhere.
Git has its own config files, I would be shocked if none of them allowed for setting the location git will default to launching in. Am I out of luck and/or being too picky?
Create a batch file with name like LaunchGit.bat & write the following command:
start F:\Program" "Files\Git\git-bash.exe --cd=D:\your\deep\workspace\path
Now you can launch it from desktop or place it in your Git home directory (and launch from there)
This may not be the most perfect solution, but it will solve your problem.
And ofCouse this is just an idea and you can change/improve it.
Use git-bash configuration to change the directory, if this is what you want.
In ~/.bash_profile (create it if it does not exist), add
cd /path/to/git/repository
The reason to use ~/.bash_profile instead of ~/.bashrc is because the latter is read and executed when an interactive shell that is not a login shell is started (if exists).

How to go to a specific file in Mac Terminal?

I'm trying to follow a walkthrough and this is one of the steps, "go to that same folder in Terminal (if you can't do that you should probably quit now)" I'm not very familiar with Mac's Terminal, but don't feel like quitting. If it helps, I need to run a grep -r "what I'm looking for" command on the file. I really have no idea what I need to do to run that command, but the rest of the walkthrough is pretty thorough, so I know I can follow the next few steps.
You need to move to the directory where that file is stored, for this the command is cd. For example lets say the file is located in a directory names MyDir in the Desktop, the command will be
cd /Users/{YOUR_USERNAME_HERE}/Desktop/MyDir
You can run ls command here to check if the file is actually present in this directory or not

Rookie - Ruby: Run file in terminal

Very inexperienced Ruby student here.
I’m not sure how to write a Ruby program in Atom, save it then try to run it in the terminal (Mac OSX).
Could someone run me through the absolute basics, please?
Forgive my cluelessness!
Ruby programs generally use the '.rb' extension, so in order to run a ruby file that you've written, you need to save it somewhere with that extension first- eg. 'my-app.rb'.
It's a good idea when starting out to save it in a folder inside your "Home" directory (/Users/your user name/). You can find that in the mac "Finder" by clicking on the folder on the left hand list that's named "your username". In your terminal, your home directory is shortened to '~/' - and you can easily change directory into it with that shortcut:
cd ~
While I've been learning, I've stuck to a quick, short directory to store my files- '~/code/'. Anything will do, but it's much quicker to type 'cd ~/code/my-app.rb' than to type something long like 'cd ~/Documents/Programming/Ruby/my-app.rb' every time. So when you're deciding on where to save, think about how much you'll have to type in terminal! :)
Once you've saved your file, and used 'cd' to change into the directory you've saved it in, you use the command 'ruby' to run it.
ruby my-app.rb
That's about all there is to actually running your file! There's so much more to using the terminal, and writing code- but there's plenty of info out there on how to start.
I found Chris Pine's "Learn To Program" really simple and easy to follow. There are plenty of other resources out there, too! Try out Try Ruby to get going straight in your browser.

Terminal - No such file or directory exists

So complete newbie question, but I've googled it and tried all their suggestions and I can't get it to work still :(
Trying to learn about the terminal... so I've created two files on my Desktop - filea.txt, fileb.txt - when I try to run the cd command I get the error, "No such file or directory exists".
I'm in the Desktop so that isn't the problem.
Is there anyone who could please suggest anything I can try?
I appreciate the help, and am completely grateful to anyone who answers - I understand time is valuable.
Thank you!
On an ubuntu to change to Desktop, you should type cd ~/Desktop, now you are in the Desktop directory, now typing ls would should list your files and directories on your desktop. Now you can open your file on a text editing application such as gedit by typing gedit filea.txt, which would open the file filea.txt in the text editor.
If you're trying to change directory to desktop and it's giving you that error, try typing cd .. which goes back one directory, and repeat to go back as far as you can and then try changing directory to desktop again.

OS X - Make returning "Nothing to be done for <filename>"

First of all, I would like to apologize if I'm on the wrong stackexchange network, and secondly, sorry if I'm overlooking something simple.
I was moving files from my old hard drive from an old PC when I came across several password protected ZIP Files. However, since those files were a bit old, I forgot the passwords already. I tried every password I could come up with but I still came up empty. After several google searches, I found this tool/utility for Mac OS X that could help me. So I go to the downloads page and download the Mac OSX utility tool and the source code.
However, I am having problems executing the make command for the file. It says on the downloads page:
If you are using linux or another unix, you need to download the source code, uncompress it and type "make" to compile the utility.
So far, what I've tried is
$make /Users/myname/Downloads/aapr-0.01-source/Makefile
I have also tried the other files in the source folder but nothing worked. After that, I'm pretty much blank. I tried double clicking the aapr file in the utility download for Mac (which is a Unix Executable) and it opens a new terminal window displaying the commands and such. Also, doing $aapr [options] [filename] only shows me -bash: aapr: command not found. I also updated XCodes command line tools.
Sorry if I'm missing out on something very basic, I don't usually use the terminal on the OS X.
Try running
cd /Users/myname/Downloads/aapr-0.01-source
make
A Makefile contains rules for building files from other files but it is based on paths and contents, etc. which depend on your current location. So generally you need to be in the directory of the project for it to work.
Edit (copied from my comment):
To execute a command from a specific location (that isn't in the normal $PATH) you need to specify a path for it. So something like /bin/bash or ./aapr (where ./ means the current directory).

Resources