16 ms·
Using Unix as an IDE (2012)
- partycoder 8y agoIf using LLVM, you may want to debug with lldb instead. Also with gdb you can use the tui mode. To read the environment variables used by a program you can use cat /proc/{pid}/environ update: Some of this overlaps with reverse engineering. I posted this comment yesterday about useful reverse engineering resources on Linux https://news.ycombinator.com/item?id=17342197 https://news.ycombinator.com/item?id=17342197
- glandium 8y agoNote that `/proc/$pid/environ` has null bytes between the entries, so it's not very readable if you just `cat` it. So you want to filter its content, e.g.: tr "\0" "\n" < /proc/$pid/environ
- samuell 8y agoI found cgdb much easier to use and more robust when resizing the terminal than gdb+tui. Liked it so much I made a video demonstrating it's usage: https://youtu.be/OKLR6rrsBmI https://youtu.be/OKLR6rrsBmI
- laumars 8y ago> To read the environment variables used by a program This is only the environmental variables used when the program launches. If said program changes any environmental variables during the course of it's execution then /proc/$pid/environ wouldn't be updated to reflect that. I expect you're already aware of this but it's worth me mentioning just in case anyone reading this thread wasn't aware.
- rbc 8y agoIt's not for everyone, but the Unix/BSD/Linux shell is still my favorite command invocation environment. Despite their simplicity, pipelines are a really handy way to pass data between programs when solving certain kinds problems. It also provides a cheap way of providing some parallel processing.
- zrobotics 8y agoThe other thing I absolutely love about pipes is the ease of writing custom utilities. I'd refactored a filetype for use with a game last week, and needed to insert several lines into ~1.5k ASCII files. 1/2 hour to make a hacked c++ program to make the changes, and pass the outputs of grep to that. Although I'm unfamiliar with using pipes to provide parallel processing, could you elaborate? If you can pass to another thread I will be kicking myself for missing that.
- flukus 8y ago> Although I'm unfamiliar with using pipes to provide parallel processing, could you elaborate? If you can pass to another thread I will be kicking myself for missing that. You didn't miss it, each stage in the pipeline runs in it's own process so you're already using it. With say "grep -r foo ./ | do-something | do-omething-else" the second and third stages will be operating on the data from grep while grep is still running. In addition to that you can get more parallelism pretty simply with xargs (http://offbytwo.com/2011/06/26/things-you-didnt-know-about-xargs.html http://offbytwo.com/2011/06/26/things-you-didnt-know-about-x...). If that's not enough then check out gnu parallel (https://www.gnu.org/software/parallel/ https://www.gnu.org/software/parallel/). While we're talking about unix as an IDE I want to put in a plug for inotifywait (https://linux.die.net/man/1/inotifywait https://linux.die.net/man/1/inotifywait). Combining this with a makefile you can get some very fast builds with near instant feedback everytime you save a file. I have one that executes units tests and valgrind every time for instant memory leak detection. Another great use case is getting WYSIWYG like features with latex files.
- harry8 8y agousing make -j $num is another way to go to get parallelism that is sometimes convenient.
- flukus 8y agoJust make sure $num is set, otherwise it tries to do everything it can at once. I found out the hard way compiling gcc last week, system was unresponsive so I reset, but I'm curious if it would have worked eventually.
- pvg 8y agoPreviouslies: https://hn.algolia.com/?query=unix%20as%20ide&sort=byPopularity&prefix=false&page=0&dateRange=all&type=story https://hn.algolia.com/?query=unix%20as%20ide&sort=byPopular...
- haolez 8y agoHighly recommend the inotify tools. It makes things like auto reloading very easy to setup.
- DarkCrusader2 8y agoThough it looks like unmaintained, I use watchdog[1] for automatically running build and test commands on file change. [1] https://github.com/gorakhargosh/watchdog https://github.com/gorakhargosh/watchdog
- lloeki 8y agoMaybe look into the very unix-y fswatch, which is cross platform too. https://github.com/emcrisostomo/fswatch https://github.com/emcrisostomo/fswatch
- twblalock 8y agoI like Acme because it is built to facilitate using shell commands from within the editor. You can write scripts in any language you like and run them, which in some ways makes it the ultimate scriptable editor. However, an IDE like IntelliJ brings so much to the table that it's hard to imagine working without it. I know I'm much more productive using it than Emacs or Acme or Vi or any other editor that integrates well with Unix.
- coliveira 8y agoIntelliJ only seems fantastic because it is so tightly integrated with the language you want to use. That's why the company has to release a separate product for each major language they support. Considering this, IntelliJ cannot be considered as being in the same league as a general text editor such as vi or emacs, it is instead a special-purpose Java source editor.
- pjmlp 8y agoThat is called market segmentation, a well known business technique. You can use InteliJ enterprise and all the plugins. Eclipse, Visual Studio, Netbeans, XCode, Android Studio and many other IDEs of yore always supported multiple languages.
- tambourine_man 8y agoOne thing that annoyed me the last time I tried it (webstorm variation if I’m not mistaken) is that you can’t use it as an editor only. You have to create a project. For everything. And of course, multi-second launch time is unacceptable for an editor in my book. It’s just too frustrating. But yeah, autocompletion is amazing. It even understands image dimensions. And it understands PHP, JavaScript, HTML and CSS, all mixed toguether in the same file, respecting indentation and syntax highlighting like nothing I’ve ever seen.
- bigpeopleareold 8y agoThis is the type of tradeoff I have with Emacs vs. an IDE. Certain IDE-like features are good enough for Emacs; it was better with IDEs. However, IDEs were designed for specific purposes. Having the flexibility of the same text editor at the same time is probably more important than possibly faster autocompletion.
- Teckla 8y agoMidnight Commander (mc) is also a great file management tool.
- kakwa_ 8y agoranger (or rangerfm) is also quite nice. It provide a 3 columns view with either: * parent directory | current directory | child directory * parent directory | current file | preview of the file (if possible in text) I found it quite nice to use because it gives you a good picture of where you are and what are your neighboring files, which can be helpful when navigating inside a code base.
- Rolpa 8y agoBut the idea of an OS in and of itself is the ultimate IDE, is it not? I can't say I like the idea of writing software without any system calls at my disposal.
- pjmlp 8y agoThat is the case of C, because UNIX is the runtime, hence what was left out of ISO ended up on POSIX. Any programming language with a richer runtime can be OS agnostic to a certain point. The runtime is the OS.
- smadge 8y agoMaybe this is implicitly assumed, but a terminal multiplexer such as tmux is also a useful utility for using unix as an IDE. For example, you can have a pane for your code in an editor like vim, and a pane for running your tests next to it, and maybe another pane for an interactive shell of your language. Lacking a consistent local development environment, tmux is indispensable when I ssh into into my remote development environment.
- thewizardofaus 8y agoOn a similar note if you like tmux, give i3 window manager a go!
- flukus 8y agoManjaro i3 (https://manjaro.org/category/community-editions/i3/ https://manjaro.org/category/community-editions/i3/) is a very nice pre-riced one. Despite a lot of unnecessary bling you wouldn't get with a stock install it gave my crappy old dell laptop a new lease on life.
- coatmatter 8y agoManjaro i3 has a few good ideas but had I started using i3wm through that, I'd probably have been turned off it. It's just not my cup of tea. Fedora Magazine has a pretty decent guide for setting up i3 to a functional state and I can recommend it: https://fedoramagazine.org/getting-started-i3-window-manager/ https://fedoramagazine.org/getting-started-i3-window-manager...
- majewsky 8y agoThese days, you can also run terminals as panels in vim, so vim is sort of its own terminal multiplexer now. :help terminal.txt
- skriticos2 8y agoI tend to just write a command in a vim buffer (with all that nice Vim magic), select it and run it with :@" e.g. I write and yank: r!fancy command arg1 arg2 .. Then go to the next line and do :@" This will run the command (well execute the colon mode command) and read back the results. edit: The nice thing about this is that I can do this as a progressing document (command, output, command, output) and scroll back to see what I have done and what the result was.
- cryptonector 8y agotmux + cscope + a $CSCOPE_EDITOR script that starts $EDITOR in a new tmux window == awesome. EDIT: Also, add nested tmux sessions to make it awesome++.
- jlebrech 8y agois it possible to write man pages for tasks rather than commands. so you could have: man search, man restart, man compile. etc.
- majewsky 8y agoManpage names are not tied to command names at all. Sure, sections 1 and 8 are conventionally sorted by command name, but the other sections have different purposes. Sections 2 and 3 document system calls and library calls, one function at a time: man 2 fork man 3 fread Section 5 documents file formats and conventions: man 5 passwd man 5 rsyncd.conf And section 7 is described by `man man` as "miscellaneous". There is some nice high-level overview documentation hidden in there, e.g.: man 7 signal man 7 socket My all-time favorite is from section 7 is `man ascii`. Very handy when you're ever pushing bits. NOTE: If these commands fail for you, check if you have the "man-pages" package installed (may be called different in your distro).
- NVRM 8y agols -ltrapR