Questions tagged [command-line]

The command-line is the interactive interface to your shell.

Filter by
Sorted by
Tagged with
0
votes
3answers
961 views

How to list full path of files/directories using only ls command (working in a restricted shell)

I have restricted shell on Production environment servers in my company, leaving me with handful of command choices. I am trying to get full path of files/directories using only ls command. I can't ...
0
votes
1answer
42 views

Install Let's Encrypt SSL certificate on Oracle Linux Server

I am trying to install a Let's Encrypt certificate on a Oracle Linux Server 7.6. Since the server does not have a public IP, I had to validate via DNS.I followed the instructions here https://github....
-1
votes
1answer
31 views

Make shell interpret operators enclosed in single-quotes [closed]

I have two commands built using the logical operator &&. The two commands are enclosed in single-quotes because they are to be passed as a command to root: $ su -c 'sed -i '1i TEXT' file1.txt ...
-1
votes
0answers
27 views

I am new to running more complex commands on the command line and need help figuring out what is going wrong here [migrated]

I want to run a one-liner to enable me to get the hash of a string and eventually compare it to a hash I can just copy at the end of the command later. I'm confident I can figure out how to do the ...
1
vote
2answers
1k views

Deactivate Nvidia Graphic-Card CLI

How can I deactivate my dedicated NVIDIA gc via CLI? My Laptop has 2 graphic cards, an integrated INTEL gc and a dedicated NVIDIA gc? I have no use for the NVIDIA gc, because I don't play anymore (...
14
votes
7answers
5k views

How to find files with 100% NUL characters in their contents?

What is the Linux command-line command that can identify such files? AFAIK the find command (or grep) can only match a specific string inside the text file. But I want to match whole contents, i.e. ...
27
votes
1answer
6k views

How to permanently disable Ctrl-s in terminal?

From here I understand that to disable Ctrl+S the stty -ixon command can be used and it works, but as soon as I close the terminal and open another I have to re-enter the command. To permanently ...
3
votes
2answers
63 views

How do I add a new mime type for file -i?

On our server, we have some issues with mime types. I need to add the mime type for Microsoft Publisher files, so that file -b -i theFile.pub prints application/x-mspublisher to the command line. I ...
5
votes
2answers
2k views

How to get drive SERIAL number from mountpoint?

If lsblk -o NAME,SERIAL,MOUNTPOINT includes the following in its output sdb X55MM4827123 └─sdb1 └─luks-4d0dc651-9aa6-452d-9442-7b33d95f8427 /...
0
votes
0answers
40 views

Different output between command line and crontab

I'm trying to send an alert whenever a connection between 2 different machines gets lost. Basically I need to see from PC N°2 if there is an established connection from PC N°4 to port 6031 on PC N°5. ...
5
votes
4answers
3k views

How do I move all the files with the same name scattered through the file system into one folder?

I have a file system tree and on different locations within it are files with the same name. I tried the following command on the command line: find / -name "HAHA" -exec mv {} /home \; It only ...
0
votes
1answer
1k views

QxcbConnection Error!

I am trying to run a program namely "rosnode" by entering command "rosrun turtlesim turtlesim_node". The command is suppose to open up a window of program, but what it does is give the following error:...
-4
votes
1answer
38 views

Fedora Command Line [on hold]

A few questions about commands relating to a removable device. What sort of command can locate the device file used by a USB? As in the directory it creates to open the actual USB. How do I mount a ...
1
vote
1answer
36 views

Fedora terminal script to create a directory and copy a file to directory

I need help to write a script to create a directory, so far I have mkdir ./directory. This would create a folder called Directory, but I need to make it ask if the user wants to copy a file called ...
1
vote
3answers
40 views

Suppress rsync warnings but not errors

I'm using rsync to transfer from one server to another using an account that has no home directory: rsync user@server:source target Password: Could not chdir to home directory /dev/null: Not a ...
1
vote
1answer
885 views

Grep -v filter not working

I want to filter grep results by using grep -v option. But the output does not differ when using a particular pattern. contents of log.log: ERROR error EXCEPTION exception <STATUS>ERROR</...
0
votes
2answers
1k views

Is there a way to use this command without having to type 'y' all the time?

I am trying to remove all ruby gems before uninstalling ruby. The command I am using is: sudo gem uninstall --all to achieve this. However, I have to type y continually to remove things. Is ...
2
votes
4answers
430 views

How to prevent command substitution on the command line?

I find that when writing text as input to another program, any command substitutions in double quotes within the intended text are interpreted and expanded by the shell The links in the answer here ...
134
votes
3answers
232k views

Sort and count number of occurrence of lines

I have Apache logfile, access.log, how to count number of line occurrence in that file? for example the result of cut -f 7 -d ' ' | cut -d '?' -f 1 | tr '[:upper:]' '[:lower:]' is a.php b.php a.php c....
3
votes
3answers
39 views

How to save command as well as output of that command to a file [duplicate]

Hi I want to save both output of a command and the command that has been run to create the output into the same single file. I understand either of *some_command* > file.txt *some_command* | ...
0
votes
1answer
900 views

Trying to mount and recover data from a DVD/recorder HDD

I have a old DVD/HDD recorder (Panasonic DMR-EH58) with RCA inputs & outputs etc. I want to recover all the recordings off its HDD. The HDD is a 2008 ATA/IDE 7200RPM Hitachi deskstar Model no:...
4
votes
3answers
1k views

Is it possible to view the list of file names of a zip file which is inside another zip file?

I know I can use unzip -l file.zip to view the file list of a zip file. But a got a zip file inside another zip file. I tried unzip -l file.zip/sub_file.zip, but failed. Is it possible to view the ...
8
votes
4answers
3k views

Rename images to exif time: Make unique filenames

If I rename images via exiv to the exif date time, I do the following: find . -iname \*jpg -exec exiv2 -v -t -r '%Y_%m_%d__%H_%M_%S' rename {} \; Now it might happen that pictures have exactly the ...
0
votes
0answers
13 views

Installed zsteg with gem but command isn't recognised

I installed zsteg with gem with the line "sudo gem install zsteg" and everything installed perfectly, but when I type "zsteg" or any valid command that the zsteg documentation says should work all I ...
2
votes
2answers
73 views

Move the cursor directly to `<keyword>` in a long command line

I often find myself in a long command-line, where it can be a pain to navigate to a specific location in the middle by means of Left-Arrow, Right-Arrow, Alt+B, Alt+F etc. I know that using tmux, I ...
2
votes
1answer
35 views

curl in non-interactive mode

I am trying to automate stuff which includes installing rust through curl https://sh.rustup.rs -sSf | sh . This is interactive and queries for user-input to choose from i.e. "1" "2" or "3". I am ...
-3
votes
5answers
6k views

Brute-force 4 digit pin with pass using shell script

I am doing some challenges. This is one them. I am trying to brute-force 4 digit pin with the password to get my desired answer. After connecting to the port It prompts me to enter the password then ...
1
vote
1answer
897 views

Sync two Directories without rsync

I know what you are thinking right now "Just use rsync" but unfortunately this system does not have rsync, and I would like to come up with another solution. The Setup: The source Server has a ...
147
votes
10answers
58k views

Is there a one-liner that allows me to create a directory and move into it at the same time?

I find myself repeating a lot of: mkdir longtitleproject cd longtitleproject Is there a way of doing it in one line without repeating the directory name? I'm on bash here.
27
votes
4answers
22k views

How is bc different from dc?

What are the differences between dc and bc calculators? When should I use dc and when bc?
9
votes
1answer
584 views

Explain why watch 'jobs' does not work but watch 'ps' work?

jobs is my favorite command to see my codes which are running in the background. In order to check for them dynamically, I tend to type watch 'jobs' which does not display anything. However watch '...
0
votes
1answer
113 views

How to use the bash shell with Python in place of /bin/sh

I have commands that could be executed in a terminal, but I want to execute them directly from my python script, except that my script it launches the commands in /bin/sh, and my terminal is bash. ...
3
votes
2answers
148 views

Uptime command misconception with suspend and resume states

The definition for uptime is "Tell how long the system has been running." but if you change your system power state to suspend or resume: # uptime 09:50:33 up 8 min, 2 users, load average: 0,24, 0,...
84
votes
15answers
390k views

How to connect to a serial port as simple as using SSH?

Is there a way to connect to a serial terminal just as you would do with SSH? There must be a simpler way than tools such as Minicom, like this $ serial /dev/ttyS0 I know I can cat the output from ...
0
votes
3answers
892 views

How to merge two csv files with common but differently ordered headers?

I have multiple files (>150) with multiple columns (>150). Most of the headers are common but occur in different order (as eg below): File 1: Col1 Col2 Col3 Col4 Col5 A B C D E File 2: ...
1
vote
1answer
27 views

Check if an application is running and is visible to the user

I need to know if an application is running and is visible to the user or if is running but minimized (not visible to the user) I am able to get the pid of my application with pgrep studio but I ...
74
votes
11answers
118k views

Sorting files according to size recursively

I need to find the largest files in a folder. How do I scan a folder recursively and sort the contents by size? I have tried using ls -R -S, but this lists the directories as well. I also tried ...
0
votes
3answers
58 views

Bash, get links from pdf

Os ubuntu. Need to get links or more data (for example binding layer from QuarkXPress application) from pdf to text, in terminal. Tried pdftotext, but seems links are not exported, pdfgrep is the ...
3
votes
3answers
2k views

What is a Linux command that lists only USB storage devices?

I would like to list only the USB storage devices connected to my computer. Since these are SCSI disks, I used the command lsscsi, which lists the USB drives as well as my computer's hard drive and CD ...
0
votes
2answers
51 views

Piped greps for looking inside files

(self-migrated from ask-ubuntu because it's linux-related, not ubuntu, and my os isn't ubuntu) I'm trying to make a grep that looks like this: grep -r 2019 | grep -riv FAILED | grep -rl DSL I want ...
-1
votes
1answer
87 views

What is a system tool? [closed]

I frequently come across the term system tool, so I wanted to understand the exact meaning of it in Linux. Which of the following three explanations of a system tool in Linux is correct? Is a system ...
0
votes
0answers
14 views

CLI or ncurses tool for browsing local network?

I have a console-only SSH-based pivot box inside a remote location. I want a console or ncurses-based tool that shows me active real-time information on which hosts are up. IP, hostname, etc. ...
3
votes
1answer
70 views

How to trim down Amazon Linux OS for more free space?

I use EC2 on Amazon Web Services. The OS of the t2.micro instance is a customized “Amazon Linux” with 1 GiB RAM and 1 vCPU. When accessing this instance via their Cloud9 IDE I find that by default ...
2
votes
3answers
145 views

How to delete hibernation files on deb based system

I have a Kali VM that is seized up, during booting it says "resuming from hibernation" and does not progress. There is no disk i/o. I am wondering if it is possible to completely delete the files ...
149
votes
22answers
127k views

Markdown Viewer

I found a file formatted with Markdown. Could you guys suggest what viewer that I could use to view this type of files? Hopefully one without gui (if it's possible) Update I was actually looking for ...
1
vote
2answers
1k views

How to find commands associated to a package? [duplicate]

Sometimes I find myself installing a package and then trying to run a command using the same name, like with geoip-bin package: $ sudo apt install geoip-bin [...] $ geoip-bin geoip-bin: command not ...
0
votes
1answer
2k views

open up emacs in gui instead of terminal

I downloaded Emacs in Linux 14.04, and when i type Emacs filename.c, it opens Emacs in the terminal instead of the external Graphical User Interface. How do I force Emacs to open outside of the ...
42
votes
6answers
122k views

Move all files with a certain extension from multiple subdirectories into one directory

I have a bunch of .zip files in several directories: Fol1/Fol2 Fol3 Fol4/Fol5 How would I do move them all to a common base folder?
2
votes
3answers
663 views

Scroll by line in terminal rather than by page Shift + PgUp

Is there a keyboard way to scroll the terminal by line the same way we scroll with mouse wheel? Shift+PgUp/PgDown give only by-page scrolling. I would like to scroll slowly as with mouse wheel. My ...
0
votes
2answers
69 views

How to save the progress of the “find” command?

I have big directory tree of files. I often use the find command to locate something in that tree. The first time after a reboot it takes some time, but subsequent uses are almost instant. Obviously ...