Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Friday, October 30, 2020

Going "console only "on GNU/Linux

Got frustrated with the time taken for the browser to load up and then dependency trap for installing other gui applications. Add to that the nuisance of gtk and qt quirks on a 4K monitor. The feeling is share by many. But as we shall see living in this place is not easy. The major difficult piece of the puzzle is the browser. All your banking, shopping options are ruled out in the terminal. 

 

What I did here was to disable even the start of the X server. I disabled sytemd unit which is supposed to reach the graphical login target. Disabled the graphical login manager, lightdm in my case. Disabled all the cloud stuff which ubuntu GNU/Linux starts with lot of difficulty. In fact, because of this the first boot of ubuntu after install is a hit or a miss. After boot do not try to login immediately. There are plenty of things ubuntu is doing in that phase. If you try to login, it will fail. Wait for 10 minutes, approx, it might be higher so that it spews many lines of information over the login prompt, then it will allow you to login and change the default password. 

 

Disabled ssh service, because the rpi 4 is connected to a 4K monitor. Even during login, ubuntu tries to plenty of things. It will try to check for updates and provide a notification once in the motd. It will also provide information from the ubuntu motd server which canonical wants you to see. It will also spew out certain information from your computer like memory usage, load on the cpu etc. All this will take plenty of time considering the rpi 4. Find the respective scripts and disable them to speed up the time required to reach the login prompt. So, we have reached the login prompt. The fonts are so tiny, you have to squint to type any commands. First thing is to first reconfigure the fonts. Get the biggest font available while running the re configuring tool. Yes, the size can be changed, but the fonts are horrible. They are not for your daily tasks. All the fonts which you had installed in your X is now out of reach. 

 

The console well, is a console. It will display fonts which are baked into the linux kernel. If anybody knows how to change the fonts on the default console, kindly advice or drop a link. But, as of now, we have a readable console and the font size is alright. The fonts are not. We have been pampered for the variety of fonts on X. It is a requirement that we should do something about it. Step in, fbterm. As the name suggests it is a terminal emulator designed to work with a framebuffer. The biggest advantage, supports all the fonts supported on X. There goes my first gripe about the console. So, we install fbterm and start and run it at the console. The console is taken over by fbterm and again we have micro-sized fonts, but nice looking fonts taken from the X environment you had installed earlier. Let us go ahead and fix the fonts by restarting fbterm with fbterm -s 24. This was for my monitor. Try experimenting with different sizes to get the optimum size. 

 

The config file for fbterm is in .fbtermrc. Well, I already see your smiling face and I have received your gratitude and in turn it is time to congratulate you for completing the first time required for living in the console. Whatever further tools we are planning to used depends on this success. The fonts are beautiful and they are your favorite ones. They look good and it is as though you are back on your terminal emulator on X, but without all its bells and whistles(another name for bloat). You now can clearly distinguish between l and 1, 0 and O, I and L. I would like to thank all the creators of fonts which can clearly distinguish the characters of the English language. It is an artists job and the creator of any font is an artist. 

 

You opened the fbterm man page and want to edit the configuration file by reading the manual, you are out of luck. You are on the console. There are no windowing systems. What d you do, you press C-A-F2 and switch to the next virtual console and login again. Then you can switch between the virtual consoles. Your are now flabbergasted. You have started hating yourself for moving away from X. But, fritter not, there are further goodies which come with fbterm. You can create multiple windows and switch to them using shortcuts as mentioned in the fbterm man page. This will give you a method of moving between multiple windows and then moving between them. 

 

 Let us go to the next step. Now, you would like to group certain windows and recognize them for a specific task group. You have a web page related, you have a manual page related and couple of windows concerned to the programming task related to the web page and the man page. You are out of luck. You cant see all the windows at once together on one single screen. Frustration. Enter terminal multiplexer. The first name which comes to he mind is tmux, if you are a year 2000 person and screen, if you are before that. These are excellent tools and are blind faith groups unto themselves. So, if you like a tool, silently use them. Do not compare them and publish your comparisons. This is because, if you have reached a position where you compare both these tools, that means you already "prefer" one among them. This will start a war. We already have the longest running war between Vi and GNU Emacs. These are the kitchen sinks of terminal multiplexers. 

 

If you are a person believing in the *nix philosophy of "One tool that does one thing and does it best", then you have an alternate option. Many a times I had tried to pull myself together and learn tmux, but since I was using the i3 wm, I thought that it is not worth the effort. I could open as many windows and all would be started side by side preparing a huge canvas for exchanging information. I am in love with i3 wm for its simplicity and doing what it is supposed to do and doesnt do anything more. A huge shoutout to all the devs and users of this fantastic wm. Now, once again my terminal multiplexer flames were re-kindled by Mr. Bronie Robertson on his youtube channel. I like his videos. They are short and to the point with excellent examples and use case scenarios. 

 

Plentiful thanks to him for introducing me to abduco. Such a strange name. If there are explanations for the name kindly enlighten me. A session management tool with such a strange and difficult to pronounce name. However, what caught my attention was the ease with which Bronie did the session management. No obscure keystrokes to remember. Just session management and nothing else. In fact, I understood session management in that under 10 minutes video, than I had tried for a good 10 years. So, Thank you Bronie. Yes, there might be plenty other things required for complex setups, but for a desktop use and a home network user, that is exactly what the doctor would prescribe. 

 

 So, three main things which a session manager has to do. Create a session. Detach a session. Re-connect to a session. abduco does all the three with elan. All technicalities, I would redirect you to Mr. Bronie. So to create a session, let us understand what is a session. A session is a group of tasks related to one another. It is a method of grouping applications and open files related to a task on hand. Let us say the session you have created contains a compile task which will take another hour. Now, you are free to let us say, listen to some music, read a novel, well, things like that. What we now do is, detach the task on hand. And now, the compiling and all other windows are moved to the background and keep running. We will now create another session and do the relaxing stuff related to music and reading. You now want to continue listening to music and then you would like to check your online accounts like your email, your toots etc. You detach the multimedia session and start a new session with these applications. Its been an hour and you would like check on your compile session, You detach the online session and re-connect to compiling session and so on. That is session management for dummies. 

 

But in a session, if you have to have multiple windows grouped together, it is all good in an X environment. If you remember we are at a console running fbterm. We were very happy with good fonts but a bit sad about moving between windows as every window occupied the complete screen making it very difficult to share information between windows. Enter dvtm. The expansion will be dynamic virtual terminal manager. The name tells everything. It is there to manage windows. It will create, position, delete windows. It is an equivalent to i3 wm and more close to dwm wm but for terminals. When we create a new window in dvtm, we are starting a new terminal waiting for our input. dvtm does exactly what i3 does. It just arranges windows side by side in many different ways. But all your window contents are there for you to see and transfer between windows in the same screen. For our case it is a window manager for the console. 

 

I hated the console because if you wanted to refer to a man page and return back to the editor, you had to suspend the editor read up and remember the man page and then suspend the man page and bring back the editor to the foreground and dump whatever you remembered from the man page. This is no way ideal. For the optimal setup, we combine a session manager with a terminal manager and you have Window management for the console. How do we do it? Well just run both the commands in unison as so.

 

abduco -c session_name dvtm -m ^x 

 

What we are doing is asking our session manager abduco to create(-c) a new session and name that session "session-name" and the application it has to run is dvtm. The next option is for the MOD key. The default key for the MOD key is ^g. Yes, you are a bit confused here. For i3 users, the MOD key used to be a single key like the super key or the ALT key. But, these keys are not recognized by the console. So keep the default or change it to the value which I use, since x is close to the control key than the g key. Once you run this command, a session is created and control is handed over to dvtm. Now here you can start using the keybindings as suggested in the man page of dvtm. MOD-c will create a window in the tiled mode. Another MOD-c press will create another terminal window and so on. MOD-j and MOD-k will move between the windows and all windows are available in one single screen. 

 

I cannot express my joy, when I saw my console splitting into multiple windows. For everything else there is MasterCard. You did plenty of work by moving between windows and your program is now copiling. Time to relax. Detach the session by pressing MOD-\. You now land back at your console. Now run another command as so abduco -c relax dvtm -m ^x You get a fresh canvas. Create multiple windows again for playing your music with lyrics, reading a book by the next window. 

 

Enough of recreation, back to work. But, you want the music continue to play and want the book you were reading to be at the same place. Detach this session again by pressing MOD-\. Run without any arguments, abduco, will list all the live sessions. Run this command with the session name abduco -a session_name Now you are connected back to your compiling and editing session with all the windows as you left them when you detached from this session. The compiling is not complete, detach again and then re-connect to your relax session and continue reading your book. 

 

You are smiling. Your low spec PC is so responsive. But, But, We are living in a modern world and it is very difficult to survive without a pdf viewer, an image viewer, a video player, an ebook reader, a music player, a text reader(should we talk about it), web browser, a spread sheet, a document writer, a presentation tool and what not........ 

 

Let us try and resolve these applications one by one.

1. Let us start with a pdf viewer. This was rather easy. I was happy that the less command is more than capable of displaying text based pdfs. It will display pdfs with images, but the images are ignored.

2. An image viewer. For this the framebuffer image viewer, fbi is upto the task and is enough for viewing images and also includes the capability to perform a slideshow of the images supplied to the command.

3. For a Text reader/editor we are spoilt for choice and I would rather not talk about the options here. Whatever I talk about would be less.

4. If we come to the web browser, we do have choices, but none capable of handling 2 - 4GB of modern websites. We have applications for displaying true html. Blogs written with text only are a joy to read. I would recommend w3m. It also has support for images(I have not tried out this feature). If you access gopher holes or the modern avatar, the gemini space, then you are in luck and there are plenty of options. With the gopher and gemini protocol, you are at home in the console. Want to access your banking site, forget it.

5. If you are on the fediverse, there are clients for the mastodon network. There are clients for reddit.

6. For reading ebooks like epubs and mobis, I would recommend epy.

7. For searching the web we have the duckduckgo client ddgr and surfraw. Both are powerful and meet all the web searching requirements. 

8. Playing music has always been easy on the console with plenty of applications. My personal favorite is the mpd and mpc combination with ncmcpp added into the mix. 

9. For playing video, mpv is my default goto. The framebuffer device plays most of the videos thrown at it. 

This has already been a very long post. If you made it this far, then you are definitely a console junkie. If I could give you a hint of the entrance to the rabbit hole, then I would be most happy. Dont forget to buy yourself a mechanical keyboard. Thanks to all the devs and users who wrote all those wonderful applications and of course GNU/Linux. The journey with the tux and the beastie and the puffer since the year 2000 has been nothing but joy. I would like to end the post with the tagline of distrowatch. "Put the fun back into computing. Use GNU/Linux, Freebsd, Openbsd, Netbsd, Plan9, templeos, Haiku, Minix, GNU ..."



Sunday, May 5, 2019

The modern web is f*&*d

            It required the mozilla firefox's debacle to understand how complicated and shitty the  www has become. It is no more interlinking of html files. It is a treasure trove of executables. Executables are supposed to be run on your own personal computer/laptop. Every web page you open runs executable code. I just want to view the page. If i want to execute something, i will do it. But, the "I" for one is totally absent. It is "we". They decide what is to be show and executed. You, poor chap want to read the text in a html page. You point the browser to that exact html link. What do you get. Nothing. Yes, you get nothing out of everything. The world wide web to start with was such a joy. I remember seeing one of my richer friends using the www and I thought it was so serene. It was like God, if there was one has come down. It was like Krishna with all his knowledge is only waiting for you to ask the right questions. The answers are all there but tied to the right questions. It was like an interlinked answer sheet for "everything".

              What has the web come to now. The chromium browser i use, is the, ungoogled chromium build with all the plugins required for removing ads, privacy guarding, javascript disabling stuff. The link i wanted to open did not open until i disabled the script blocking plugin. Now, what is this page i was looking at. I was looking at a page from mozilla's website which was periodically being updated during this addons debacle. You know what, the page was not displayed until i enabled scripts to run. Why are scripts running here. Yes, I dont know how the modern www works. I just know how to make it look better from a client point of view. youtube doesnt display on the chromium browser with scripts disabled. I was just reading about the way youtube was started by its hipster devs. I felt very sorry for them. A big organization taking control of your pet project starts by giving you that processing power you need to start with. Then starts the acquisition of everything. You lose your identity. All acquisitions start with giving the acquired the promise of independence. Now, independence, is an intoxicating word. It is like you are suddenly on one of the private beaches and you are being told you are the owner and here is the money to run it.

                  From here the buyer will start scheming. How is he gonna integrate this independent entity into his largesse. Everything will happen bit by bit. The buyer will tell I am going to install security guards for "your" teams safety. Now, you are cornered and in the coming days you will screw your team or will exit it altogether for the team to fend themselves. The remaining team have to just go with the buyer. You and your efforts are still not recognized in the vc market. So you continue for a few days become goody goody with the buyer and incorporate whatever you are asked. There ends the independent product.

                    When I started using the public network. It was so neat. You want to download a big file do it from my ftp server. Dont clog my http server, other users will feel the latency. Your http server will "only" serve http pages and links, nothing else. You wanted to write a blog go ahead and register to organizations specialized in doing so. The tool will only concentrate on making blogging experience better. All of a sudden the blogging landscape became zero. All the blogs were searchable. What an utopian condition. Now, you write your blogs. It does not come up in any searches though it will be the only matching web page based on your searches. But the first 100/10000/N results will yield results what the "algorithms" tell. Now, algorithms is a good word for the big corporations to escape from responsibility. The algorithms are so complicated that i believe it is out of human intervention considering the complex rules which includes government rules, paid content, the ISP and what not. The user and the creator are totally lost in this maze.

                  Everybody wants to build a bigger walled garden. A stronger walled garden. Is everything in the walled garden accessible to everybody in that particular walled garden. No. The products are same as the industry. A person working beside somebody will not know about the salary of the next. But, all work in the same walled garden. The products are also the same. There is no openness left in this industry. There has to be a revolution. This revolution has to happen from the bourgeoisie, the content creators. The content creators have to wage the war. It is not that difficult. The internet allows the freedom  and tools to do it.

              I had a book named internet with me, purchased when i started to understand how the internet works. I remembered that book and gave it a visit. It might seem idiotic now, but, there was one word which caught my eye, "gopher" Sadly the number of articles on this protocol is at the minimal on the public network. But, this was until I went down one of the gopher hole. From here it was rabbit hole.

             I request all the content creators to host a gopher server and advertise it along the http pages. I loved the simplicity of the protocol(Come on, the http was just to have linkable web pages and travel down the rabbit hole). If you want your content to be searchable and help other people put it on plain html websites or put it in a gopher hole. Start using it, you will fall in love immediately, with its simplicity, with its methodology of serving content. Its adaptability to deliver content in terms of text file and to download other content like music/movies/pdf etc.

The servers available

af          A simple gopher server written in Lua, with a blogging module
geomidae    A simple gopher client written in C
Attua       A gopher server writting in Retro, A forth dialect


The clients available

sacc    A simple console gopher client
cgo     A simple console gopher client
vf1     Majority of the hackers on gopher tend to use it.

For more info enter the
gopher://bitreich.org:70    with your gopher client

The above is a very small list. I have come across much more. At this moment of writing I have used the above and remember them well.

           I spend all my time on GNU/Linux, FreeBSD, OpenBSD. Therefore all the collections are projects running on these platforms. What an awesome community/developers are out there. It has been an honor to use your hard work and your passion.